]> git.sesse.net Git - mlt/commitdiff
fix jack-stopped event with some JACK clients
authorDan Dennedy <dan@dennedy.org>
Tue, 3 Apr 2012 04:50:15 +0000 (21:50 -0700)
committerDan Dennedy <dan@dennedy.org>
Tue, 3 Apr 2012 04:50:15 +0000 (21:50 -0700)
It appears that JackTransportStopped is not received in JackSyncCallback
unless the client that calls jack_transport_stop() also calls
jack_transport_locate().

src/modules/jackrack/filter_jackrack.c

index 4ec111647afe80c7ae19fec07e16b2f2a2e90922..8b850cbe0904ea73bac5c944f4e6cc0284e11482 100644 (file)
@@ -304,6 +304,18 @@ static int jack_process (jack_nframes_t frames, void * data)
                }
        }
 
+       // Often jackd does not send the stopped event through the JackSyncCallback
+       jack_client_t *jack_client = mlt_properties_get_data( properties, "jack_client", NULL );
+       jack_position_t jack_pos;
+       jack_transport_state_t state = jack_transport_query( jack_client, &jack_pos );
+       int transport_state = mlt_properties_get_int( properties, "_transport_state" );
+       if ( state != transport_state )
+       {
+               mlt_properties_set_int( properties, "_transport_state", state );
+               if ( state == JackTransportStopped )
+                       jack_sync( state, &jack_pos, filter );
+       }
+
        return err;
 }