Browse Source

Move init code after possibly failing allocation code in JackNetDriver::Init.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2903 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 15 years ago
parent
commit
5840c47cc0
2 changed files with 24 additions and 14 deletions
  1. +17
    -14
      common/JackNetDriver.cpp
  2. +7
    -0
      common/JackNetInterface.cpp

+ 17
- 14
common/JackNetDriver.cpp View File

@@ -48,6 +48,8 @@ namespace Jack
fParams.fTransportSync = transport_sync;
fParams.fNetworkMode = network_mode;
fLastTimebaseMaster = -1;
fMidiCapturePortList = NULL;
fMidiPlaybackPortList = NULL;
#ifdef JACK_MONITOR
fNetTimeMon = NULL;
#endif
@@ -120,20 +122,6 @@ namespace Jack
//set global paramaters
SetParams();

//driver parametering
JackAudioDriver::SetBufferSize ( fParams.fPeriodSize );
JackAudioDriver::SetSampleRate ( fParams.fSampleRate );

JackDriver::NotifyBufferSize ( fParams.fPeriodSize );
JackDriver::NotifySampleRate ( fParams.fSampleRate );

//transport engine parametering
fEngineControl->fTransport.SetNetworkSync ( true );

//allocate midi ports lists
fMidiCapturePortList = new jack_port_id_t [fParams.fSendMidiChannels];
fMidiPlaybackPortList = new jack_port_id_t [fParams.fReturnMidiChannels];

//register jack ports
if ( AllocPorts() != 0 )
{
@@ -181,6 +169,21 @@ namespace Jack
};
fNetTimeMon->SetPlotFile ( net_time_mon_options, 2, net_time_mon_fields, 5 );
#endif
//driver parametering
JackAudioDriver::SetBufferSize ( fParams.fPeriodSize );
JackAudioDriver::SetSampleRate ( fParams.fSampleRate );

JackDriver::NotifyBufferSize ( fParams.fPeriodSize );
JackDriver::NotifySampleRate ( fParams.fSampleRate );

//transport engine parametering
fEngineControl->fTransport.SetNetworkSync ( true );

//allocate midi ports lists
fMidiCapturePortList = new jack_port_id_t [fParams.fSendMidiChannels];
fMidiPlaybackPortList = new jack_port_id_t [fParams.fReturnMidiChannels];
assert(fMidiCapturePortList);
assert(fMidiPlaybackPortList);

return true;
}


+ 7
- 0
common/JackNetInterface.cpp View File

@@ -20,6 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackNetInterface.h"
#include "JackException.h"
#include "JackPlatformPlug.h"
#include <assert.h>

using namespace std;

@@ -169,6 +170,8 @@ namespace Jack
//network buffers
fTxBuffer = new char[fParams.fMtu];
fRxBuffer = new char[fParams.fMtu];
assert(fTxBuffer);
assert(fRxBuffer);

//net audio/midi buffers'addresses
fTxData = fTxBuffer + sizeof ( packet_header_t );
@@ -269,10 +272,14 @@ namespace Jack
//midi net buffers
fNetMidiCaptureBuffer = new NetMidiBuffer ( &fParams, fParams.fSendMidiChannels, fTxData );
fNetMidiPlaybackBuffer = new NetMidiBuffer ( &fParams, fParams.fReturnMidiChannels, fRxData );
assert(fNetMidiCaptureBuffer);
assert(fNetMidiPlaybackBuffer);

//audio net buffers
fNetAudioCaptureBuffer = new NetAudioBuffer ( &fParams, fParams.fSendAudioChannels, fTxData );
fNetAudioPlaybackBuffer = new NetAudioBuffer ( &fParams, fParams.fReturnAudioChannels, fRxData );
assert(fNetAudioCaptureBuffer);
assert(fNetAudioPlaybackBuffer);

//audio netbuffer length
fAudioTxLen = sizeof ( packet_header_t ) + fNetAudioPlaybackBuffer->GetSize();


Loading…
Cancel
Save