Restart diskstreams when track I/O is reconfigured.
This commit is contained in:
parent
9ce8701283
commit
8a0da04a4b
|
@ -96,7 +96,13 @@ void
|
||||||
Disk_Stream::shutdown ( void )
|
Disk_Stream::shutdown ( void )
|
||||||
{
|
{
|
||||||
_terminate = true;
|
_terminate = true;
|
||||||
pthread_join( _thread, NULL );
|
|
||||||
|
/* try to wake the thread so it'll see that it's time to die */
|
||||||
|
block_processed();
|
||||||
|
|
||||||
|
if ( _thread )
|
||||||
|
pthread_join( _thread, NULL );
|
||||||
|
|
||||||
_terminate = false;
|
_terminate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ protected:
|
||||||
|
|
||||||
pthread_t _thread; /* io thread */
|
pthread_t _thread; /* io thread */
|
||||||
|
|
||||||
Track *_th; /* Track we belong to */
|
Track *_th; /* Track we belong to */
|
||||||
|
|
||||||
nframes_t _nframes; /* buffer size */
|
nframes_t _nframes; /* buffer size */
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
const pthread_mutex_t _mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
|
||||||
|
|
||||||
class Mutex
|
class Mutex
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -30,7 +32,8 @@ public:
|
||||||
|
|
||||||
Mutex ( )
|
Mutex ( )
|
||||||
{
|
{
|
||||||
pthread_mutex_init( &_lock, NULL );
|
// pthread_mutex_init( &_lock, NULL );
|
||||||
|
_lock = _mutex_initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Mutex ( )
|
virtual ~Mutex ( )
|
||||||
|
|
|
@ -423,6 +423,17 @@ Track::configure_outputs ( int n )
|
||||||
{
|
{
|
||||||
int on = output.size();
|
int on = output.size();
|
||||||
|
|
||||||
|
if ( n == on )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// engine->lock();
|
||||||
|
|
||||||
|
Playback_DS *ds = playback_ds;
|
||||||
|
playback_ds = NULL;
|
||||||
|
|
||||||
|
ds->shutdown();
|
||||||
|
delete ds;
|
||||||
|
|
||||||
if ( n > on )
|
if ( n > on )
|
||||||
{
|
{
|
||||||
for ( int i = on; i < n; ++i )
|
for ( int i = on; i < n; ++i )
|
||||||
|
@ -444,6 +455,10 @@ Track::configure_outputs ( int n )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
playback_ds = new Playback_DS( this, engine->frame_rate(), engine->nframes(), output.size() );
|
||||||
|
|
||||||
|
// engine->unlock();
|
||||||
/* FIXME: bogus */
|
/* FIXME: bogus */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -453,6 +468,17 @@ Track::configure_inputs ( int n )
|
||||||
{
|
{
|
||||||
int on = input.size();
|
int on = input.size();
|
||||||
|
|
||||||
|
if ( n == on )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// engine->lock();
|
||||||
|
|
||||||
|
Record_DS *ds = record_ds;
|
||||||
|
record_ds = NULL;
|
||||||
|
|
||||||
|
ds->shutdown();
|
||||||
|
delete ds;
|
||||||
|
|
||||||
if ( n > on )
|
if ( n > on )
|
||||||
{
|
{
|
||||||
for ( int i = on; i < n; ++i )
|
for ( int i = on; i < n; ++i )
|
||||||
|
@ -474,6 +500,10 @@ Track::configure_inputs ( int n )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record_ds = new Record_DS( this, engine->frame_rate(), engine->nframes(), input.size() );
|
||||||
|
|
||||||
|
// engine->unlock();
|
||||||
|
|
||||||
/* FIXME: bogus */
|
/* FIXME: bogus */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue