Browse Source

InSynched not really needed in NetJack2.

tags/v1.9.10
Stephane Letz 12 years ago
parent
commit
f7d0f8ee49
5 changed files with 25 additions and 45 deletions
  1. +8
    -14
      common/JackNetAPI.cpp
  2. +0
    -5
      common/JackNetInterface.cpp
  3. +0
    -2
      common/JackNetInterface.h
  4. +15
    -21
      common/JackNetManager.cpp
  5. +2
    -3
      common/JackNetTool.cpp

+ 8
- 14
common/JackNetAPI.cpp View File

@@ -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;


+ 0
- 5
common/JackNetInterface.cpp View File

@@ -445,11 +445,6 @@ namespace Jack
return tx_bytes;
}

bool JackNetMasterInterface::IsSynched()
{
return (fCurrentCycleOffset <= fMaxCycleOffset);
}

int JackNetMasterInterface::SyncSend()
{
SetRcvTimeOut();


+ 0
- 2
common/JackNetInterface.h View File

@@ -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();



+ 15
- 21
common/JackNetManager.cpp View File

@@ -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) {


+ 2
- 3
common/JackNetTool.cpp View File

@@ -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;
}


Loading…
Cancel
Save