Browse Source

[0.92.0] refix transport bug:000023

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@590 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
joq 21 years ago
parent
commit
cd2c606889
4 changed files with 33 additions and 27 deletions
  1. +12
    -11
      jack/internal.h
  2. +0
    -1
      jackd/engine.c
  3. +18
    -12
      jackd/transengine.c
  4. +3
    -3
      libjack/transclient.c

+ 12
- 11
jack/internal.h View File

@@ -61,7 +61,7 @@
#endif #endif


#ifndef TRUE #ifndef TRUE
#define TRUE (!FALSE)
#define TRUE (1)
#endif #endif


typedef struct _jack_engine jack_engine_t; typedef struct _jack_engine jack_engine_t;
@@ -96,8 +96,8 @@ typedef struct {
int8_t new_pos; /* new position this cycle */ int8_t new_pos; /* new position this cycle */
int8_t pending_pos; /* new position request pending */ int8_t pending_pos; /* new position request pending */
jack_nframes_t pending_frame; /* pending frame number */ jack_nframes_t pending_frame; /* pending frame number */
uint32_t sync_clients; /* number of active slowsync clients */
uint32_t sync_remain; /* number of them with sync_poll */
int32_t sync_clients; /* number of active_slowsync clients */
int32_t sync_remain; /* number of them with sync_poll */
jack_time_t sync_timeout; jack_time_t sync_timeout;
jack_time_t sync_time_left; jack_time_t sync_time_left;
jack_frame_timer_t frame_timer; jack_frame_timer_t frame_timer;
@@ -166,14 +166,15 @@ typedef volatile struct {
volatile jack_client_state_t state; /* w: engine and client r: engine */ volatile jack_client_state_t state; /* w: engine and client r: engine */
volatile int8_t name[JACK_CLIENT_NAME_SIZE+1]; volatile int8_t name[JACK_CLIENT_NAME_SIZE+1];
volatile ClientType type; /* w: engine r: engine and client */ volatile ClientType type; /* w: engine r: engine and client */
volatile int8_t active : 1; /* w: engine r: engine and client */
volatile int8_t dead : 1; /* r/w: engine */
volatile int8_t timed_out : 1; /* r/w: engine */
volatile int8_t is_timebase : 1; /* w: engine, r: engine and client */
volatile int8_t timebase_new : 1; /* w: engine and client, r: engine */
volatile int8_t is_slowsync : 1; /* w: engine, r: engine and client */
volatile int8_t sync_poll : 1; /* w: engine and client, r: engine */
volatile int8_t sync_new : 1; /* w: engine and client, r: engine */
volatile int8_t active; /* w: engine r: engine and client */
volatile int8_t dead; /* r/w: engine */
volatile int8_t timed_out; /* r/w: engine */
volatile int8_t is_timebase; /* w: engine, r: engine and client */
volatile int8_t timebase_new; /* w: engine and client, r: engine */
volatile int8_t is_slowsync; /* w: engine, r: engine and client */
volatile int8_t active_slowsync; /* w: engine, r: engine and client */
volatile int8_t sync_poll; /* w: engine and client, r: engine */
volatile int8_t sync_new; /* w: engine and client, r: engine */
volatile pid_t pid; /* w: client r: engine; client pid */ volatile pid_t pid; /* w: client r: engine; client pid */
volatile pid_t pgrp; /* w: client r: engine; client pgrp */ volatile pid_t pgrp; /* w: client r: engine; client pgrp */
volatile uint64_t signalled_at; volatile uint64_t signalled_at;


+ 0
- 1
jackd/engine.c View File

@@ -2590,7 +2590,6 @@ jack_zombify_client (jack_engine_t *engine, jack_client_internal_t *client)


client->control->dead = TRUE; client->control->dead = TRUE;
jack_transport_client_exit (engine, client);
jack_client_disconnect (engine, client); jack_client_disconnect (engine, client);
jack_client_do_deactivate (engine, client, FALSE); jack_client_do_deactivate (engine, client, FALSE);
} }


+ 18
- 12
jackd/transengine.c View File

@@ -59,7 +59,8 @@ jack_sync_poll_new (jack_engine_t *engine, jack_client_internal_t *client)
* *
* precondition: caller holds the graph lock. */ * precondition: caller holds the graph lock. */
static inline void static inline void
jack_sync_poll_exit (jack_engine_t *engine, jack_client_internal_t *client)
jack_sync_poll_deactivate (jack_engine_t *engine,
jack_client_internal_t *client)
{ {
if (client->control->sync_poll) { if (client->control->sync_poll) {
client->control->sync_poll = 0; client->control->sync_poll = 0;
@@ -68,6 +69,9 @@ jack_sync_poll_exit (jack_engine_t *engine, jack_client_internal_t *client)
VERBOSE (engine, "sync poll interrupted for client %" VERBOSE (engine, "sync poll interrupted for client %"
PRIu32 "\n", client->control->id); PRIu32 "\n", client->control->id);
} }
client->control->active_slowsync = 0;
engine->control->sync_clients--;
assert(engine->control->sync_clients >= 0);
} }


/* stop polling all the slow-sync clients /* stop polling all the slow-sync clients
@@ -82,8 +86,7 @@ jack_sync_poll_stop (jack_engine_t *engine)
for (node = engine->clients; node; node = jack_slist_next (node)) { for (node = engine->clients; node; node = jack_slist_next (node)) {
jack_client_internal_t *client = jack_client_internal_t *client =
(jack_client_internal_t *) node->data; (jack_client_internal_t *) node->data;
if (client->control->is_slowsync &&
client->control->active &&
if (client->control->active_slowsync &&
client->control->sync_poll) { client->control->sync_poll) {
client->control->sync_poll = 0; client->control->sync_poll = 0;
poll_count++; poll_count++;
@@ -113,8 +116,7 @@ jack_sync_poll_start (jack_engine_t *engine)
for (node = engine->clients; node; node = jack_slist_next (node)) { for (node = engine->clients; node; node = jack_slist_next (node)) {
jack_client_internal_t *client = jack_client_internal_t *client =
(jack_client_internal_t *) node->data; (jack_client_internal_t *) node->data;
if (client->control->is_slowsync &&
client->control->active) {
if (client->control->active_slowsync) {
client->control->sync_poll = 1; client->control->sync_poll = 1;
sync_count++; sync_count++;
} }
@@ -248,6 +250,8 @@ void
jack_transport_activate (jack_engine_t *engine, jack_client_internal_t *client) jack_transport_activate (jack_engine_t *engine, jack_client_internal_t *client)
{ {
if (client->control->is_slowsync) { if (client->control->is_slowsync) {
assert(!client->control->active_slowsync);
client->control->active_slowsync = 1;
engine->control->sync_clients++; engine->control->sync_clients++;
jack_sync_poll_new (engine, client); jack_sync_poll_new (engine, client);
} }
@@ -300,8 +304,8 @@ jack_transport_client_exit (jack_engine_t *engine,
} }


if (client->control->is_slowsync) { if (client->control->is_slowsync) {
jack_sync_poll_exit(engine, client);
engine->control->sync_clients--;
if (client->control->active_slowsync)
jack_sync_poll_deactivate (engine, client);
if (client->control->dead) if (client->control->dead)
client->control->is_slowsync = 0; client->control->is_slowsync = 0;
} }
@@ -314,6 +318,7 @@ jack_transport_client_new (jack_client_internal_t *client)
client->control->is_timebase = 0; client->control->is_timebase = 0;
client->control->timebase_new = 0; client->control->timebase_new = 0;
client->control->is_slowsync = 0; client->control->is_slowsync = 0;
client->control->active_slowsync = 0;
client->control->sync_poll = 0; client->control->sync_poll = 0;
client->control->sync_new = 0; client->control->sync_new = 0;
client->control->sync_cb = NULL; client->control->sync_cb = NULL;
@@ -335,10 +340,9 @@ jack_transport_client_reset_sync (jack_engine_t *engine,
client = jack_client_internal_by_id (engine, client_id); client = jack_client_internal_by_id (engine, client_id);


if (client && (client->control->is_slowsync)) { if (client && (client->control->is_slowsync)) {
jack_sync_poll_exit(engine, client);
if (client->control->active_slowsync)
jack_sync_poll_deactivate (engine, client);
client->control->is_slowsync = 0; client->control->is_slowsync = 0;
if (client->control->active)
engine->control->sync_clients--;
ret = 0; ret = 0;
} else } else
ret = EINVAL; ret = EINVAL;
@@ -364,12 +368,14 @@ jack_transport_client_set_sync (jack_engine_t *engine,
if (client) { if (client) {
if (!client->control->is_slowsync) { if (!client->control->is_slowsync) {
client->control->is_slowsync = 1; client->control->is_slowsync = 1;
if (client->control->active)
if (client->control->active) {
client->control->active_slowsync = 1;
engine->control->sync_clients++; engine->control->sync_clients++;
}
} }


/* force poll of the new slow-sync client, if active */ /* force poll of the new slow-sync client, if active */
if (client->control->active)
if (client->control->active_slowsync)
jack_sync_poll_new (engine, client); jack_sync_poll_new (engine, client);
ret = 0; ret = 0;
} else } else


+ 3
- 3
libjack/transclient.c View File

@@ -145,10 +145,10 @@ jack_call_sync_client (jack_client_t *client)
jack_client_control_t *control = client->control; jack_client_control_t *control = client->control;
jack_control_t *ectl = client->engine; jack_control_t *ectl = client->engine;


/* Make sure we are still slow-sync; is_slowsync is set in a
* critical section; sync_cb is not. */
/* Make sure still active and slow-sync; active_slowsync is
* set in a critical section; sync_cb is not. */
if ((ectl->new_pos || control->sync_poll || control->sync_new) && if ((ectl->new_pos || control->sync_poll || control->sync_new) &&
control->is_slowsync) {
control->active_slowsync) {


if (control->sync_cb (ectl->transport_state, if (control->sync_cb (ectl->transport_state,
&ectl->current_time, &ectl->current_time,


Loading…
Cancel
Save