From 849e366f4e85f7ca69b32afc5f41945df9552857 Mon Sep 17 00:00:00 2001 From: sletz Date: Fri, 27 Mar 2009 14:10:52 +0000 Subject: [PATCH] Add a buffer size callback for netmaster that just remove the client (it will be recreated with the new parameters). git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3471 0c269be4-1314-0410-8aa9-9f06e86f4224 --- ChangeLog | 4 ++++ common/JackNetInterface.cpp | 9 ++++++--- common/JackNetManager.cpp | 13 ++++++++++++- common/JackNetManager.h | 4 ++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ac7fe66..c0400f85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,10 @@ Torben Hohn Jackdmp changes log --------------------------- +2009-03-26 Stephane Letz + + * Add a buffer size callback for netmaster that just remove the client (it will be recreated with the new parameters). + 2009-03-26 Stephane Letz * First working JackBoomerDriver two threads version. diff --git a/common/JackNetInterface.cpp b/common/JackNetInterface.cpp index 27495c18..78e9dbb9 100644 --- a/common/JackNetInterface.cpp +++ b/common/JackNetInterface.cpp @@ -329,9 +329,6 @@ namespace Jack jack_error ( "Can't send suicide request : %s", StrError ( NET_ERROR_CODE ) ); mcast_socket.Close(); - - // UGLY temporary way to be sure the thread does not call code possibly causing a deadlock in JackEngine. - ThreadExit(); } int JackNetMasterInterface::Recv ( size_t size, int flags ) @@ -349,6 +346,9 @@ namespace Jack jack_error ( "'%s' : %s, exiting.", fParams.fName, StrError ( NET_ERROR_CODE ) ); //ask to the manager to properly remove the master Exit(); + + // UGLY temporary way to be sure the thread does not call code possibly causing a deadlock in JackEngine. + ThreadExit(); } else jack_error ( "Error in master receive : %s", StrError ( NET_ERROR_CODE ) ); @@ -373,6 +373,9 @@ namespace Jack //fatal connection issue, exit jack_error ( "'%s' : %s, exiting.", fParams.fName, StrError ( NET_ERROR_CODE ) ); Exit(); + + // UGLY temporary way to be sure the thread does not call code possibly causing a deadlock in JackEngine. + ThreadExit(); } else jack_error ( "Error in master send : %s", StrError ( NET_ERROR_CODE ) ); diff --git a/common/JackNetManager.cpp b/common/JackNetManager.cpp index 96db9fae..86d23522 100644 --- a/common/JackNetManager.cpp +++ b/common/JackNetManager.cpp @@ -127,7 +127,11 @@ namespace Jack return false; } - jack_set_process_callback ( fJackClient, SetProcess, this ); + if (jack_set_process_callback(fJackClient, SetProcess, this ) < 0) + goto fail; + + if (jack_set_buffer_size_callback(fJackClient, SetBufferSize, this) < 0) + goto fail; if ( AllocPorts() != 0 ) { @@ -369,6 +373,13 @@ namespace Jack { return ( fReturnTransportData.fState == JackTransportNetStarting ); } + + int JackNetMaster::SetBufferSize (jack_nframes_t nframes, void* arg) + { + jack_error("Cannot handle bufer size change, so proxy will be removed..."); + static_cast ( arg )->Exit(); + return 0; + } //process----------------------------------------------------------------------------- int JackNetMaster::SetProcess ( jack_nframes_t nframes, void* arg ) diff --git a/common/JackNetManager.h b/common/JackNetManager.h index 6e05759f..b6ad7857 100644 --- a/common/JackNetManager.h +++ b/common/JackNetManager.h @@ -39,6 +39,7 @@ namespace Jack friend class JackNetMasterManager; private: static int SetProcess ( jack_nframes_t nframes, void* arg ); + static int SetBufferSize (jack_nframes_t nframes, void* arg); static void SetTimebaseCallback ( jack_transport_state_t state, jack_nframes_t nframes, jack_position_t* pos, int new_pos, void* arg ); //jack client @@ -63,8 +64,7 @@ namespace Jack bool Init(bool auto_connect); int AllocPorts(); void FreePorts(); - void Exit(); - + //transport void EncodeTransportData(); void DecodeTransportData();