Commit 96376a0f authored by sletz's avatar sletz
Browse files

Simplify audio packet order verification.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3261 0c269be4-1314-0410-8aa9-9f06e86f4224
parent ea5d0296
......@@ -26,6 +26,8 @@ Michael Voigt
2009-01-26 Stephane Letz <letz@grame.fr>
* Fix JackNetInterface::SetNetBufferSize for socket buffer size computation and JackNetMasterInterface::DataRecv if synch packet is received, various cleanup.
* Fix in JackAlsaAdapter::Open.
* Simplify audio packet order verification.
2009-01-19 Stephane Letz <letz@grame.fr>
......
......@@ -82,7 +82,7 @@ struct JackMidiBuffer
uint32_t lost_events;
uint32_t mix_index;
JackMidiEvent events[0];
JackMidiEvent events[1]; // Using 0 size does not compile with older GCC versions, so use 1 here.
int IsValid() const
{
......
......@@ -383,8 +383,7 @@ namespace Jack
{
fTxHeader.fSubCycle = subproc;
fTxHeader.fIsLastPckt = ( ( subproc == ( fTxHeader.fNMidiPckt - 1 ) ) && !fParams.fSendAudioChannels ) ? 1 : 0;
fTxHeader.fPacketSize = sizeof ( packet_header_t );
fTxHeader.fPacketSize += fNetMidiCaptureBuffer->RenderToNetwork ( subproc, fTxHeader.fMidiDataSize );
fTxHeader.fPacketSize = sizeof ( packet_header_t ) + fNetMidiCaptureBuffer->RenderToNetwork ( subproc, fTxHeader.fMidiDataSize );
memcpy ( fTxBuffer, &fTxHeader, sizeof ( packet_header_t ) );
if ( Send ( fTxHeader.fPacketSize, 0 ) == SOCKET_ERROR )
return SOCKET_ERROR;
......@@ -469,6 +468,7 @@ namespace Jack
int rx_bytes = 0;
uint jumpcnt = 0;
uint recvd_midi_pckt = 0;
uint recvd_audio_pckt = 0;
packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer );
while ( !fRxHeader.fIsLastPckt )
......@@ -502,7 +502,10 @@ namespace Jack
case 'a': //audio
rx_bytes = Recv ( rx_head->fPacketSize, 0 );
if ( !IsNextPacket() )
// SL: 25/01/09
// if ( !IsNextPacket() )
// jack_error ( "Packet(s) missing from '%s'...", fParams.fName );
if (recvd_audio_pckt++ != rx_head->fSubCycle)
jack_error ( "Packet(s) missing from '%s'...", fParams.fName );
fRxHeader.fCycle = rx_head->fCycle;
fRxHeader.fSubCycle = rx_head->fSubCycle;
......@@ -512,7 +515,7 @@ namespace Jack
break;
case 's': //sync
/* SL: 25/01.09
/* SL: 25/01/09
if ( rx_head->fCycle == fTxHeader.fCycle )
return 0;
*/
......@@ -718,6 +721,7 @@ namespace Jack
int JackNetSlaveInterface::DataRecv()
{
uint recvd_midi_pckt = 0;
uint recvd_audio_pckt = 0;
int rx_bytes = 0;
packet_header_t* rx_head = reinterpret_cast<packet_header_t*> ( fRxBuffer );
......@@ -743,8 +747,11 @@ namespace Jack
case 'a': //audio
rx_bytes = Recv ( rx_head->fPacketSize, 0 );
if ( !IsNextPacket() )
jack_error ( "Packet(s) missing..." );
//SL: 25/01/09
// if ( !IsNextPacket() )
// jack_error ( "Packet(s) missing..." );
if (recvd_audio_pckt++ != rx_head->fSubCycle)
jack_error ( "Packet(s) missing from '%s'...", fParams.fName );
fRxHeader.fCycle = rx_head->fCycle;
fRxHeader.fSubCycle = rx_head->fSubCycle;
fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
......@@ -790,8 +797,7 @@ namespace Jack
{
fTxHeader.fSubCycle = subproc;
fTxHeader.fIsLastPckt = ( ( subproc == ( fTxHeader.fNMidiPckt - 1 ) ) && !fParams.fReturnAudioChannels ) ? 1 : 0;
fTxHeader.fPacketSize = sizeof ( packet_header_t );
fTxHeader.fPacketSize += fNetMidiPlaybackBuffer->RenderToNetwork ( subproc, fTxHeader.fMidiDataSize );
fTxHeader.fPacketSize = sizeof ( packet_header_t ) + fNetMidiPlaybackBuffer->RenderToNetwork ( subproc, fTxHeader.fMidiDataSize );
memcpy ( fTxBuffer, &fTxHeader, sizeof ( packet_header_t ) );
if ( Send ( fTxHeader.fPacketSize, 0 ) == SOCKET_ERROR )
return SOCKET_ERROR;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment