Browse Source

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
tags/1.90
sletz 17 years ago
parent
commit
8a2e1e2e91
4 changed files with 38 additions and 21 deletions
  1. +4
    -1
      ChangeLog
  2. +4
    -6
      common/JackClient.cpp
  3. +24
    -6
      common/JackEngine.cpp
  4. +6
    -8
      common/JackGraphManager.cpp

+ 4
- 1
ChangeLog View File

@@ -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>


+ 4
- 6
common/JackClient.cpp View File

@@ -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;
}



+ 24
- 6
common/JackEngine.cpp View File

@@ -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);


+ 6
- 8
common/JackGraphManager.cpp View File

@@ -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;
}


Loading…
Cancel
Save