From f7d0f8ee49d4f7323e0848155a92a41adbf63e16 Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Fri, 10 May 2013 13:38:25 +0200 Subject: [PATCH] InSynched not really needed in NetJack2. --- common/JackNetAPI.cpp | 22 ++++++++-------------- common/JackNetInterface.cpp | 5 ----- common/JackNetInterface.h | 2 -- common/JackNetManager.cpp | 36 +++++++++++++++--------------------- common/JackNetTool.cpp | 5 ++--- 5 files changed, 25 insertions(+), 45 deletions(-) diff --git a/common/JackNetAPI.cpp b/common/JackNetAPI.cpp index 992e78d7..4cf204b1 100644 --- a/common/JackNetAPI.cpp +++ b/common/JackNetAPI.cpp @@ -454,22 +454,16 @@ struct JackNetExtMaster : public JackNetMasterInterface { 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; diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp index 5af8dbd1..64126a52 100644 --- a/common/JackNetInterface.cpp +++ b/common/JackNetInterface.cpp @@ -445,11 +445,6 @@ namespace Jack return tx_bytes; } - bool JackNetMasterInterface::IsSynched() - { - return (fCurrentCycleOffset <= fMaxCycleOffset); - } - int JackNetMasterInterface::SyncSend() { SetRcvTimeOut(); diff --git a/common/JackNetInterface.h b/common/JackNetInterface.h index 1d9336ff..35ac3c38 100644 --- a/common/JackNetInterface.h +++ b/common/JackNetInterface.h @@ -156,8 +156,6 @@ namespace Jack int Send(size_t size, int flags); int Recv(size_t size, int flags); - bool IsSynched(); - void FatalRecvError(); void FatalSendError(); diff --git a/common/JackNetManager.cpp b/common/JackNetManager.cpp index c2244c0f..d58b5e73 100644 --- a/common/JackNetManager.cpp +++ b/common/JackNetManager.cpp @@ -495,32 +495,26 @@ namespace Jack #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 int res = SyncRecv(); switch (res) { diff --git a/common/JackNetTool.cpp b/common/JackNetTool.cpp index cc76c9e6..2e14457b 100644 --- a/common/JackNetTool.cpp +++ b/common/JackNetTool.cpp @@ -738,13 +738,12 @@ namespace Jack for (int i = 0; i < fNPorts; i++) { /* 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) { 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) { goto error; }