Restart diskstreams when track I/O is reconfigured.

This commit is contained in:
Jonathan Moore Liles 2008-04-21 13:34:15 -05:00
parent 9ce8701283
commit 8a0da04a4b
4 changed files with 42 additions and 3 deletions

View File

@ -96,7 +96,13 @@ void
Disk_Stream::shutdown ( void )
{
_terminate = true;
/* 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;
}

View File

@ -21,6 +21,8 @@
#include <pthread.h>
const pthread_mutex_t _mutex_initializer = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
class Mutex
{
@ -30,7 +32,8 @@ public:
Mutex ( )
{
pthread_mutex_init( &_lock, NULL );
// pthread_mutex_init( &_lock, NULL );
_lock = _mutex_initializer;
}
virtual ~Mutex ( )

View File

@ -423,6 +423,17 @@ Track::configure_outputs ( int n )
{
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 )
{
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 */
return true;
}
@ -453,6 +468,17 @@ Track::configure_inputs ( int n )
{
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 )
{
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 */
return true;
}