| @@ -454,22 +454,16 @@ struct JackNetExtMaster : public JackNetMasterInterface { | |||||
| fNetMidiCaptureBuffer->SetBuffer(midi_port_index, ((JackMidiBuffer**)midi_output_buffer)[midi_port_index]); | fNetMidiCaptureBuffer->SetBuffer(midi_port_index, ((JackMidiBuffer**)midi_output_buffer)[midi_port_index]); | ||||
| } | } | ||||
| if (IsSynched()) { // only send if connection is "synched" | |||||
| EncodeSyncPacket(); | |||||
| EncodeSyncPacket(); | |||||
| // send sync | |||||
| if (SyncSend() == SOCKET_ERROR) { | |||||
| return SOCKET_ERROR; | |||||
| } | |||||
| // send sync | |||||
| if (SyncSend() == SOCKET_ERROR) { | |||||
| return SOCKET_ERROR; | |||||
| } | |||||
| //send data | |||||
| if (DataSend() == SOCKET_ERROR) { | |||||
| return SOCKET_ERROR; | |||||
| } | |||||
| } else { | |||||
| jack_info("Connection is not synched, skip cycle..."); | |||||
| //send data | |||||
| if (DataSend() == SOCKET_ERROR) { | |||||
| return SOCKET_ERROR; | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| @@ -445,11 +445,6 @@ namespace Jack | |||||
| return tx_bytes; | return tx_bytes; | ||||
| } | } | ||||
| bool JackNetMasterInterface::IsSynched() | |||||
| { | |||||
| return (fCurrentCycleOffset <= fMaxCycleOffset); | |||||
| } | |||||
| int JackNetMasterInterface::SyncSend() | int JackNetMasterInterface::SyncSend() | ||||
| { | { | ||||
| SetRcvTimeOut(); | SetRcvTimeOut(); | ||||
| @@ -156,8 +156,6 @@ namespace Jack | |||||
| int Send(size_t size, int flags); | int Send(size_t size, int flags); | ||||
| int Recv(size_t size, int flags); | int Recv(size_t size, int flags); | ||||
| bool IsSynched(); | |||||
| void FatalRecvError(); | void FatalRecvError(); | ||||
| void FatalSendError(); | void FatalSendError(); | ||||
| @@ -495,32 +495,26 @@ namespace Jack | |||||
| #endif | #endif | ||||
| } | } | ||||
| if (IsSynched()) { // only send if connection is "synched" | |||||
| //encode the first packet | |||||
| EncodeSyncPacket(); | |||||
| //encode the first packet | |||||
| EncodeSyncPacket(); | |||||
| if (SyncSend() == SOCKET_ERROR) { | |||||
| return SOCKET_ERROR; | |||||
| } | |||||
| #ifdef JACK_MONITOR | |||||
| fNetTimeMon->Add((((float)(GetMicroSeconds() - begin_time)) / (float) fPeriodUsecs) * 100.f); | |||||
| #endif | |||||
| //send data | |||||
| if (DataSend() == SOCKET_ERROR) { | |||||
| return SOCKET_ERROR; | |||||
| } | |||||
| if (SyncSend() == SOCKET_ERROR) { | |||||
| return SOCKET_ERROR; | |||||
| } | |||||
| #ifdef JACK_MONITOR | |||||
| fNetTimeMon->Add((((float)(GetMicroSeconds() - begin_time)) / (float) fPeriodUsecs) * 100.f); | |||||
| #endif | |||||
| #ifdef JACK_MONITOR | |||||
| fNetTimeMon->Add((((float)(GetMicroSeconds() - begin_time)) / (float) fPeriodUsecs) * 100.f); | |||||
| #endif | |||||
| } else { | |||||
| jack_info("Connection is not synched, skip cycle..."); | |||||
| //send data | |||||
| if (DataSend() == SOCKET_ERROR) { | |||||
| return SOCKET_ERROR; | |||||
| } | } | ||||
| #ifdef JACK_MONITOR | |||||
| fNetTimeMon->Add((((float)(GetMicroSeconds() - begin_time)) / (float) fPeriodUsecs) * 100.f); | |||||
| #endif | |||||
| //receive sync | //receive sync | ||||
| int res = SyncRecv(); | int res = SyncRecv(); | ||||
| switch (res) { | switch (res) { | ||||
| @@ -738,13 +738,12 @@ namespace Jack | |||||
| for (int i = 0; i < fNPorts; i++) { | for (int i = 0; i < fNPorts; i++) { | ||||
| /* Allocate en/decoders */ | /* Allocate en/decoders */ | ||||
| fOpusMode[i] = opus_custom_mode_create( | |||||
| params->fSampleRate, params->fPeriodSize, &error); | |||||
| fOpusMode[i] = opus_custom_mode_create(params->fSampleRate, params->fPeriodSize, &error); | |||||
| if (error != OPUS_OK) { | if (error != OPUS_OK) { | ||||
| goto error; | goto error; | ||||
| } | } | ||||
| fOpusEncoder[i] = opus_custom_encoder_create(fOpusMode[i], 1,&error); | |||||
| fOpusEncoder[i] = opus_custom_encoder_create(fOpusMode[i], 1, &error); | |||||
| if (error != OPUS_OK) { | if (error != OPUS_OK) { | ||||
| goto error; | goto error; | ||||
| } | } | ||||