git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1491 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.64
| @@ -2,6 +2,14 @@ | |||||
| Jackdmp changes log | Jackdmp changes log | ||||
| --------------------------- | --------------------------- | ||||
| 2007-06-09 Stephane Letz <letz@grame.fr> | |||||
| * Checking in the server to avoid calling the clients if no callback are registered. | |||||
| 2007-06-08 Stephane Letz <letz@grame.fr> | |||||
| * New JackNotication.h header in preparation for callback checking in the server. | |||||
| 2007-05-29 Stephane Letz <letz@grame.fr> | 2007-05-29 Stephane Letz <letz@grame.fr> | ||||
| * Add "callback exiting" and "jack_frame_time" tests in jack_test. | * Add "callback exiting" and "jack_frame_time" tests in jack_test. | ||||
| @@ -135,23 +135,6 @@ class JackNotifyChannelInterface | |||||
| virtual void ClientNotify(int refnum, const char* name, int notify, int sync, int value, int* result) | virtual void ClientNotify(int refnum, const char* name, int notify, int sync, int value, int* result) | ||||
| {} | {} | ||||
| /* | |||||
| enum NotificationType { | |||||
| kAddClient = 0, | |||||
| kRemoveClient = 1, | |||||
| kActivateClient = 2, | |||||
| kXRunCallback = 3, | |||||
| kGraphOrderCallback = 4, | |||||
| kBufferSizeCallback = 5, | |||||
| kStartFreewheel = 6, | |||||
| kStopFreewheel = 7, | |||||
| kPortRegistrationOn = 8, | |||||
| kPortRegistrationOff = 9, | |||||
| kZombifyClient = 10, | |||||
| kDeadClient = 11, | |||||
| kMaxType | |||||
| }; | |||||
| */ | |||||
| }; | }; | ||||
| /*! | /*! | ||||
| @@ -175,7 +175,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, | |||||
| res = fGraphOrder(fGraphOrderArg); | res = fGraphOrder(fGraphOrderArg); | ||||
| break; | break; | ||||
| case kStartFreewheel: | |||||
| case kStartFreewheelCallback: | |||||
| JackLog("JackClient::kStartFreewheel\n"); | JackLog("JackClient::kStartFreewheel\n"); | ||||
| SetupDriverSync(true); | SetupDriverSync(true); | ||||
| fThread->DropRealTime(); | fThread->DropRealTime(); | ||||
| @@ -183,7 +183,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, | |||||
| fFreewheel(1, fFreewheelArg); | fFreewheel(1, fFreewheelArg); | ||||
| break; | break; | ||||
| case kStopFreewheel: | |||||
| case kStopFreewheelCallback: | |||||
| JackLog("JackClient::kStopFreewheel\n"); | JackLog("JackClient::kStopFreewheel\n"); | ||||
| SetupDriverSync(false); | SetupDriverSync(false); | ||||
| if (fFreewheel) | if (fFreewheel) | ||||
| @@ -191,13 +191,13 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, | |||||
| fThread->AcquireRealTime(); | fThread->AcquireRealTime(); | ||||
| break; | break; | ||||
| case kPortRegistrationOn: | |||||
| case kPortRegistrationOnCallback: | |||||
| JackLog("JackClient::kPortRegistrationOn port_index = %ld\n", value); | JackLog("JackClient::kPortRegistrationOn port_index = %ld\n", value); | ||||
| if (fPortRegistration) | if (fPortRegistration) | ||||
| fPortRegistration(value, 1, fPortRegistrationArg); | fPortRegistration(value, 1, fPortRegistrationArg); | ||||
| break; | break; | ||||
| case kPortRegistrationOff: | |||||
| case kPortRegistrationOffCallback: | |||||
| JackLog("JackClient::kPortRegistrationOff port_index = %ld \n", value); | JackLog("JackClient::kPortRegistrationOff port_index = %ld \n", value); | ||||
| if (fPortRegistration) | if (fPortRegistration) | ||||
| fPortRegistration(value, 0, fPortRegistrationArg); | fPortRegistration(value, 0, fPortRegistrationArg); | ||||
| @@ -732,6 +732,7 @@ int JackClient::SetXRunCallback(JackXRunCallback callback, void *arg) | |||||
| jack_error("You cannot set callbacks on an active client"); | jack_error("You cannot set callbacks on an active client"); | ||||
| return -1; | return -1; | ||||
| } else { | } else { | ||||
| GetClientControl()->fCallback[kXRunCallback] = (callback != NULL); | |||||
| fXrunArg = arg; | fXrunArg = arg; | ||||
| fXrun = callback; | fXrun = callback; | ||||
| return 0; | return 0; | ||||
| @@ -758,6 +759,7 @@ int JackClient::SetGraphOrderCallback(JackGraphOrderCallback callback, void *arg | |||||
| jack_error("You cannot set callbacks on an active client"); | jack_error("You cannot set callbacks on an active client"); | ||||
| return -1; | return -1; | ||||
| } else { | } else { | ||||
| GetClientControl()->fCallback[kGraphOrderCallback] = (callback != NULL); | |||||
| fGraphOrder = callback; | fGraphOrder = callback; | ||||
| fGraphOrderArg = arg; | fGraphOrderArg = arg; | ||||
| return 0; | return 0; | ||||
| @@ -770,6 +772,7 @@ int JackClient::SetBufferSizeCallback(JackBufferSizeCallback callback, void *arg | |||||
| jack_error("You cannot set callbacks on an active client"); | jack_error("You cannot set callbacks on an active client"); | ||||
| return -1; | return -1; | ||||
| } else { | } else { | ||||
| GetClientControl()->fCallback[kBufferSizeCallback] = (callback != NULL); | |||||
| fBufferSizeArg = arg; | fBufferSizeArg = arg; | ||||
| fBufferSize = callback; | fBufferSize = callback; | ||||
| return 0; | return 0; | ||||
| @@ -782,7 +785,8 @@ int JackClient::SetClientRegistrationCallback(JackClientRegistrationCallback cal | |||||
| jack_error("You cannot set callbacks on an active client"); | jack_error("You cannot set callbacks on an active client"); | ||||
| return -1; | return -1; | ||||
| } else { | } else { | ||||
| fPortRegistrationArg = arg; | |||||
| // kAddClient and kRemoveClient notifications must be delivered by the server in any case | |||||
| fClientRegistrationArg = arg; | |||||
| fClientRegistration = callback; | fClientRegistration = callback; | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -794,6 +798,8 @@ int JackClient::SetFreewheelCallback(JackFreewheelCallback callback, void *arg) | |||||
| jack_error("You cannot set callbacks on an active client"); | jack_error("You cannot set callbacks on an active client"); | ||||
| return -1; | return -1; | ||||
| } else { | } else { | ||||
| GetClientControl()->fCallback[kStartFreewheelCallback] = (callback != NULL); | |||||
| GetClientControl()->fCallback[kStopFreewheelCallback] = (callback != NULL); | |||||
| fFreewheelArg = arg; | fFreewheelArg = arg; | ||||
| fFreewheel = callback; | fFreewheel = callback; | ||||
| return 0; | return 0; | ||||
| @@ -806,6 +812,8 @@ int JackClient::SetPortRegistrationCallback(JackPortRegistrationCallback callbac | |||||
| jack_error("You cannot set callbacks on an active client"); | jack_error("You cannot set callbacks on an active client"); | ||||
| return -1; | return -1; | ||||
| } else { | } else { | ||||
| GetClientControl()->fCallback[kPortRegistrationOnCallback] = (callback != NULL); | |||||
| GetClientControl()->fCallback[kPortRegistrationOffCallback] = (callback != NULL); | |||||
| fPortRegistrationArg = arg; | fPortRegistrationArg = arg; | ||||
| fPortRegistration = callback; | fPortRegistration = callback; | ||||
| return 0; | return 0; | ||||
| @@ -248,7 +248,7 @@ void JackEngine::NotifyClient(int refnum, int event, int sync, int value) | |||||
| { | { | ||||
| JackClientInterface* client = fClientTable[refnum]; | JackClientInterface* client = fClientTable[refnum]; | ||||
| // The client may be notified by the RT thread while closing | // The client may be notified by the RT thread while closing | ||||
| if (client) { | |||||
| if (client && client->GetClientControl()->fCallback[event]) { | |||||
| if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, value) < 0) | if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, value) < 0) | ||||
| jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value); | jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value); | ||||
| } else { | } else { | ||||
| @@ -260,7 +260,7 @@ void JackEngine::NotifyClients(int event, int sync, int value) | |||||
| { | { | ||||
| for (int i = 0; i < CLIENT_NUM; i++) { | for (int i = 0; i < CLIENT_NUM; i++) { | ||||
| JackClientInterface* client = fClientTable[i]; | JackClientInterface* client = fClientTable[i]; | ||||
| if (client && (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value) < 0)) { | |||||
| if (client && client->GetClientControl()->fCallback[event] && (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value) < 0)) { | |||||
| jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value); | jack_error("NotifyClient fails name = %s event = %ld = val = %ld", client->GetClientControl()->fName, event, value); | ||||
| } | } | ||||
| } | } | ||||
| @@ -327,12 +327,12 @@ void JackEngine::NotifyBufferSize(jack_nframes_t nframes) | |||||
| void JackEngine::NotifyFreewheel(bool onoff) | void JackEngine::NotifyFreewheel(bool onoff) | ||||
| { | { | ||||
| fEngineControl->fRealTime = !onoff; | fEngineControl->fRealTime = !onoff; | ||||
| NotifyClients((onoff ? kStartFreewheel : kStopFreewheel), true, 0); | |||||
| NotifyClients((onoff ? kStartFreewheelCallback : kStopFreewheelCallback), true, 0); | |||||
| } | } | ||||
| void JackEngine::NotifyPortRegistation(jack_port_id_t port_index, bool onoff) | void JackEngine::NotifyPortRegistation(jack_port_id_t port_index, bool onoff) | ||||
| { | { | ||||
| NotifyClients((onoff ? kPortRegistrationOn : kPortRegistrationOff), false, port_index); | |||||
| NotifyClients((onoff ? kPortRegistrationOnCallback : kPortRegistrationOffCallback), false, port_index); | |||||
| } | } | ||||
| void JackEngine::NotifyActivate(int refnum) | void JackEngine::NotifyActivate(int refnum) | ||||
| @@ -29,10 +29,10 @@ namespace Jack | |||||
| kXRunCallback = 3, | kXRunCallback = 3, | ||||
| kGraphOrderCallback = 4, | kGraphOrderCallback = 4, | ||||
| kBufferSizeCallback = 5, | kBufferSizeCallback = 5, | ||||
| kStartFreewheel = 6, | |||||
| kStopFreewheel = 7, | |||||
| kPortRegistrationOn = 8, | |||||
| kPortRegistrationOff = 9, | |||||
| kStartFreewheelCallback = 6, | |||||
| kStopFreewheelCallback = 7, | |||||
| kPortRegistrationOnCallback = 8, | |||||
| kPortRegistrationOffCallback = 9, | |||||
| kZombifyClient = 10, | kZombifyClient = 10, | ||||
| kDeadClient = 11, | kDeadClient = 11, | ||||
| kMaxNotification | kMaxNotification | ||||
| @@ -39,9 +39,7 @@ namespace Jack | |||||
| struct JackRequest | struct JackRequest | ||||
| { | { | ||||
| public: | |||||
| typedef enum { | |||||
| enum RequestType { | |||||
| kRegisterPort = 1, | kRegisterPort = 1, | ||||
| kUnRegisterPort = 2, | kUnRegisterPort = 2, | ||||
| kConnectPorts = 3, | kConnectPorts = 3, | ||||
| @@ -65,7 +63,7 @@ public: | |||||
| kDisconnectNamePorts = 25, | kDisconnectNamePorts = 25, | ||||
| kNotification = 26 | kNotification = 26 | ||||
| } RequestType; | |||||
| }; | |||||
| RequestType fType; | RequestType fType; | ||||
| @@ -23,6 +23,7 @@ This program is free software; you can redistribute it and/or modify | |||||
| #include "JackServer.h" | #include "JackServer.h" | ||||
| #include "JackMachThread.h" | #include "JackMachThread.h" | ||||
| #include "JackEngine.h" | #include "JackEngine.h" | ||||
| #include "JackNotification.h" | |||||
| using namespace std; | using namespace std; | ||||
| @@ -114,7 +115,7 @@ void JackMachServerChannel::KillClient(mach_port_t private_port) | |||||
| JackLog("JackMachServerChannel::KillClient\n"); | JackLog("JackMachServerChannel::KillClient\n"); | ||||
| int refnum = fClientTable[private_port]; | int refnum = fClientTable[private_port]; | ||||
| assert(refnum > 0); | assert(refnum > 0); | ||||
| fServer->Notify(refnum, JackNotifyChannelInterface::kDeadClient, 0); | |||||
| fServer->Notify(refnum, kDeadClient, 0); | |||||
| fClientTable.erase(private_port); | fClientTable.erase(private_port); | ||||
| // Hum, hum.... | // Hum, hum.... | ||||
| @@ -492,6 +492,7 @@ | |||||
| 4B9B815C08AFA45000D05A28 /* JackRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackRequest.h; path = ../common/JackRequest.h; sourceTree = SOURCE_ROOT; }; | 4B9B815C08AFA45000D05A28 /* JackRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackRequest.h; path = ../common/JackRequest.h; sourceTree = SOURCE_ROOT; }; | ||||
| 4BA577BC08BF8BE200F82DE1 /* testSynchroClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroClient.cpp; path = ../tests/testSynchroClient.cpp; sourceTree = SOURCE_ROOT; }; | 4BA577BC08BF8BE200F82DE1 /* testSynchroClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroClient.cpp; path = ../tests/testSynchroClient.cpp; sourceTree = SOURCE_ROOT; }; | ||||
| 4BA577FB08BF8E4600F82DE1 /* testSynchroServer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroServer.cpp; path = ../tests/testSynchroServer.cpp; sourceTree = SOURCE_ROOT; }; | 4BA577FB08BF8E4600F82DE1 /* testSynchroServer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroServer.cpp; path = ../tests/testSynchroServer.cpp; sourceTree = SOURCE_ROOT; }; | ||||
| 4BB371D40C1AD85A0050C1E4 /* JackNotification.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNotification.h; path = ../common/JackNotification.h; sourceTree = SOURCE_ROOT; }; | |||||
| 4BBD13CC08C71EB40079F7FF /* testSynchroServerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroServerClient.cpp; path = ../tests/testSynchroServerClient.cpp; sourceTree = SOURCE_ROOT; }; | 4BBD13CC08C71EB40079F7FF /* testSynchroServerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSynchroServerClient.cpp; path = ../tests/testSynchroServerClient.cpp; sourceTree = SOURCE_ROOT; }; | ||||
| 4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackServerGlobals.cpp; path = ../common/JackServerGlobals.cpp; sourceTree = SOURCE_ROOT; }; | 4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackServerGlobals.cpp; path = ../common/JackServerGlobals.cpp; sourceTree = SOURCE_ROOT; }; | ||||
| 4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackServerGlobals.h; path = ../common/JackServerGlobals.h; sourceTree = SOURCE_ROOT; }; | 4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackServerGlobals.h; path = ../common/JackServerGlobals.h; sourceTree = SOURCE_ROOT; }; | ||||
| @@ -1026,6 +1027,7 @@ | |||||
| 4BA550FF05E2423600569492 /* Channels */ = { | 4BA550FF05E2423600569492 /* Channels */ = { | ||||
| isa = PBXGroup; | isa = PBXGroup; | ||||
| children = ( | children = ( | ||||
| 4BB371D40C1AD85A0050C1E4 /* JackNotification.h */, | |||||
| 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */, | 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */, | ||||
| 4BF8D1B30834EED500C94B91 /* JackInternalClientChannel.h */, | 4BF8D1B30834EED500C94B91 /* JackInternalClientChannel.h */, | ||||
| 4BFB299908AF452300D450D4 /* Socket */, | 4BFB299908AF452300D450D4 /* Socket */, | ||||