Merge pull request #2 from corrados/master

bug fix: fixed that Jamulus segfaults when jackd is restarted (Ticket…
This commit is contained in:
ignotus 2020-05-10 10:50:07 +02:00 committed by GitHub
commit b9723c0b5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 11 deletions

View file

@ -19,6 +19,8 @@
- bug fix: for mono capture jack audio interface Jamulus complains it cannot make connections (Ticket #137) - bug fix: for mono capture jack audio interface Jamulus complains it cannot make connections (Ticket #137)
- bug fix: fixed that Jamulus segfaults when jackd is restarted (Ticket #122, #127)
TODO WIP support internationalization TODO WIP support internationalization
@ -30,6 +32,7 @@ TODO show mute state of others
3.5.2 (2020-04-24) 3.5.2 (2020-04-24)
- use audio level meter bars for normal skin - use audio level meter bars for normal skin

View file

@ -184,16 +184,20 @@ void CSound::Stop()
int CSound::Init ( const int /* iNewPrefMonoBufferSize */ ) int CSound::Init ( const int /* iNewPrefMonoBufferSize */ )
{ {
// try setting buffer size // try setting buffer size
// TODO seems not to work! -> no audio after this operation! // TODO seems not to work! -> no audio after this operation!
// Doesn't this give an infinite loop? The set buffer size function will call our // Doesn't this give an infinite loop? The set buffer size function will call our
// registerd callback which calls "EmitReinitRequestSignal()". In that function // registerd callback which calls "EmitReinitRequestSignal()". In that function
// this CSound::Init() function is called... // this CSound::Init() function is called...
//jack_set_buffer_size ( pJackClient, iNewPrefMonoBufferSize ); //jack_set_buffer_size ( pJackClient, iNewPrefMonoBufferSize );
// without a Jack server, Jamulus makes no sense to run, throw an error message
if ( bJackWasShutDown )
{
throw CGenErr ( tr ( "The Jack server was shut down. This software "
"requires a Jack server to run. Try to restart the software to "
"solve the issue." ) );
}
// get actual buffer size // get actual buffer size
iJACKBufferSizeMono = jack_get_buffer_size ( pJackClient ); iJACKBufferSizeMono = jack_get_buffer_size ( pJackClient );
@ -321,7 +325,7 @@ int CSound::process ( jack_nframes_t nframes, void* arg )
return 0; // zero on success, non-zero on error return 0; // zero on success, non-zero on error
} }
int CSound::bufferSizeCallback ( jack_nframes_t, void *arg ) int CSound::bufferSizeCallback ( jack_nframes_t, void* arg )
{ {
CSound* pSound = static_cast<CSound*> ( arg ); CSound* pSound = static_cast<CSound*> ( arg );
@ -330,12 +334,11 @@ int CSound::bufferSizeCallback ( jack_nframes_t, void *arg )
return 0; // zero on success, non-zero on error return 0; // zero on success, non-zero on error
} }
void CSound::shutdownCallback ( void* ) void CSound::shutdownCallback ( void* arg )
{ {
// without a Jack server, our software makes no sense to run, throw CSound* pSound = static_cast<CSound*> ( arg );
// error message
throw CGenErr ( tr ( "The Jack server was shut down. This software " pSound->bJackWasShutDown = true;
"requires a Jack server to run. Try to restart the software to " pSound->EmitReinitRequestSignal ( RS_ONLY_RESTART_AND_INIT );
"solve the issue." ) );
} }
#endif // WITH_SOUND #endif // WITH_SOUND

View file

@ -66,7 +66,7 @@ public:
const bool bNoAutoJackConnect, const bool bNoAutoJackConnect,
const QString& strJackClientName ) : const QString& strJackClientName ) :
CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel ), CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel ),
iJACKBufferSizeMono ( 0 ) { OpenJack ( bNoAutoJackConnect, strJackClientName.toLocal8Bit().data() ); } iJACKBufferSizeMono ( 0 ), bJackWasShutDown ( false ) { OpenJack ( bNoAutoJackConnect, strJackClientName.toLocal8Bit().data() ); }
virtual ~CSound() { CloseJack(); } virtual ~CSound() { CloseJack(); }
@ -79,6 +79,7 @@ public:
CVector<short> vecsTmpAudioSndCrdStereo; CVector<short> vecsTmpAudioSndCrdStereo;
int iJACKBufferSizeMono; int iJACKBufferSizeMono;
int iJACKBufferSizeStero; int iJACKBufferSizeStero;
bool bJackWasShutDown;
jack_port_t* input_port_left; jack_port_t* input_port_left;
jack_port_t* input_port_right; jack_port_t* input_port_right;