Commit 8a2e1e2e authored by sletz's avatar sletz
Browse files

Correct JackEngine::PortUnRegister, JackEngine::ClientCloseAux and...

Correct JackEngine::PortUnRegister, JackEngine::ClientCloseAux and JackEngine::ClientDeactivate to correctly send notifications.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2298 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 17a6c17c
......@@ -20,6 +20,10 @@ Fernando Lopez-Lezcano
Jackdmp changes log
---------------------------
2008-05-21 Stephane Letz <letz@grame.fr>
* Correct JackEngine::PortUnRegister, JackEngine::ClientCloseAux and JackEngine::ClientDeactivate to correctly send notifications.
2008-05-20 Stephane Letz <letz@grame.fr>
* Package number bumped to 1.90 everywhere.
......@@ -28,7 +32,6 @@ Fernando Lopez-Lezcano
2008-05-19 Stephane Letz <letz@grame.fr>
* Use of placement new for dynamic port allocation is possibly not safe... so avoid that until a definitive answer is found.
* Cleanup.
* JackAudioDriver::ProcessAsync and JackAudioDriver::ProcessSync were broken at some point : 0 has to be returned in all cases.
2008-05-16 Stephane Letz <letz@grame.fr>
......
......@@ -279,16 +279,14 @@ int JackClient::Deactivate()
GetClientControl()->fTransportSync = false;
GetClientControl()->fTransportTimebase = false;
// We need to wait for the new engine cycle before stopping the RT thread, but this is done by ClientDeactivate
int result = -1;
fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result);
jack_log("JackClient::Deactivate res = %ld ", result);
// We need to wait for the new engine cycle before stopping the RT thread, but this is done by ClientDeactivate
jack_log("JackClient::Deactivate res = %ld", result);
// RT thread is stopped only when needed...
if (IsRealTime()) {
if (IsRealTime())
fThread->Kill();
}
return result;
}
......
......@@ -560,22 +560,22 @@ int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wai
refnum,
(client->GetClientControl()) ? client->GetClientControl()->fName : "No name");
// Remove the client from the table
ReleaseRefnum(refnum);
// Notify unregister
// Unregister all ports ==> notifications are sent
jack_int_t ports[PORT_NUM_FOR_CLIENT];
int i;
fGraphManager->GetInputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
NotifyPortRegistation(ports[i], false);
PortUnRegister(refnum, ports[i]);
}
fGraphManager->GetOutputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
NotifyPortRegistation(ports[i], false);
PortUnRegister(refnum, ports[i]);
}
// Remove the client from the table
ReleaseRefnum(refnum);
// Remove all ports
fGraphManager->RemoveAllPorts(refnum);
......@@ -624,6 +624,21 @@ int JackEngine::ClientDeactivate(int refnum)
return -1;
jack_log("JackEngine::ClientDeactivate ref = %ld name = %s", refnum, client->GetClientControl()->fName);
// Disconnect all ports ==> notifications are sent
jack_int_t ports[PORT_NUM_FOR_CLIENT];
int i;
fGraphManager->GetInputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
PortDisconnect(refnum, ports[i], ALL_PORTS);
}
fGraphManager->GetOutputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
PortDisconnect(refnum, ports[i], ALL_PORTS);
}
fGraphManager->Deactivate(refnum);
fLastSwitchUsecs = 0; // Force switch to occur next cycle, even when called with "dead" clients
......@@ -664,6 +679,9 @@ int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index)
{
jack_log("JackEngine::PortUnRegister ref = %ld port_index = %ld", refnum, port_index);
assert(fClientTable[refnum]);
// Disconnect port ==> notification is sent
PortDisconnect(refnum, port_index, ALL_PORTS);
if (fGraphManager->ReleasePort(refnum, port_index) == 0) {
NotifyPortRegistation(port_index, false);
......
......@@ -413,7 +413,7 @@ void JackGraphManager::DisconnectAllPorts(int refnum)
// Server
void JackGraphManager::DisconnectAllInput(jack_port_id_t port_index)
{
jack_log("JackGraphManager::DisconnectAllInput port_index = %ld ", port_index);
jack_log("JackGraphManager::DisconnectAllInput port_index = %ld", port_index);
JackConnectionManager* manager = WriteNextStateStart();
for (int i = 0; i < PORT_NUM; i++) {
......@@ -476,20 +476,18 @@ void JackGraphManager::Activate(int refnum)
// Server
void JackGraphManager::Deactivate(int refnum)
{
DisconnectAllPorts(refnum);
// Disconnect only when needed
if (IsDirectConnection(refnum, FREEWHEEL_DRIVER_REFNUM)) {
DirectDisconnect(refnum, FREEWHEEL_DRIVER_REFNUM);
} else {
jack_log("JackServer::Deactivate: client = %ld was not activated ", refnum);
jack_log("JackServer::Deactivate client = %ld was not activated", refnum);
}
// Disconnect only when needed
if (IsDirectConnection(FREEWHEEL_DRIVER_REFNUM, refnum)) {
DirectDisconnect(FREEWHEEL_DRIVER_REFNUM, refnum);
} else {
jack_log("JackServer::Deactivate: client = %ld was not activated ", refnum);
jack_log("JackServer::Deactivate client = %ld was not activated", refnum);
}
}
......@@ -523,14 +521,14 @@ int JackGraphManager::Connect(jack_port_id_t port_src, jack_port_id_t port_dst)
if (!src->fInUse || !dst->fInUse) {
if (!src->fInUse)
jack_error("JackGraphManager::Connect: port_src = %ld not used name = %s", port_src, GetPort(port_src)->fName);
jack_error("JackGraphManager::Connect port_src = %ld not used name = %s", port_src, GetPort(port_src)->fName);
if (!dst->fInUse)
jack_error("JackGraphManager::Connect: port_dst = %ld not used name = %s", port_dst, GetPort(port_dst)->fName);
jack_error("JackGraphManager::Connect port_dst = %ld not used name = %s", port_dst, GetPort(port_dst)->fName);
res = -1;
goto end;
}
if (src->fTypeId != dst->fTypeId) {
jack_error("JackGraphManager::Connect: different port types: port_src = %ld port_dst = %ld", port_src, port_dst);
jack_error("JackGraphManager::Connect different port types port_src = %ld port_dst = %ld", port_src, port_dst);
res = -1;
goto end;
}
......
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