added option to turn off automatic reconnect feature
This commit is contained in:
parent
028f6d98fd
commit
426a126181
|
@ -8,6 +8,7 @@ DarkIce next release
|
||||||
including support for MacOS X.
|
including support for MacOS X.
|
||||||
Thanks to Nicholas J. Humfrey <njh@ecs.soton.ac.uk>
|
Thanks to Nicholas J. Humfrey <njh@ecs.soton.ac.uk>
|
||||||
o various improvements by Joel Ebel <jbebel@ncsu.edu>
|
o various improvements by Joel Ebel <jbebel@ncsu.edu>
|
||||||
|
o added option to turn off automatic reconnect feature
|
||||||
|
|
||||||
15-02-2004: DarkIce 0.14 released
|
15-02-2004: DarkIce 0.14 released
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
[general]
|
[general]
|
||||||
duration = 60 # duration of encoding, in seconds. 0 means forever
|
duration = 60 # duration of encoding, in seconds. 0 means forever
|
||||||
bufferSecs = 5 # size of internal slip buffer, in seconds
|
bufferSecs = 5 # size of internal slip buffer, in seconds
|
||||||
|
reconnect = yes # reconnect to the server(s) if disconnected
|
||||||
|
|
||||||
# this section describes the audio input that will be streamed
|
# this section describes the audio input that will be streamed
|
||||||
[input]
|
[input]
|
||||||
|
|
|
@ -50,6 +50,10 @@ Time for DarkIce to run, in seconds. If 0, run forever.
|
||||||
Data read from the sound card is buffered before sent to
|
Data read from the sound card is buffered before sent to
|
||||||
the encoder. Each buffer will be able to hold this
|
the encoder. Each buffer will be able to hold this
|
||||||
many seconds of samples.
|
many seconds of samples.
|
||||||
|
.TP
|
||||||
|
.I reconnect
|
||||||
|
Try to reconnect to the server(s) if the connection is broken during
|
||||||
|
streaming, "yes" or "no". (optional parameter, defaults to "yes")
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
.B [input]
|
.B [input]
|
||||||
|
|
|
@ -129,6 +129,7 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
unsigned int sampleRate;
|
unsigned int sampleRate;
|
||||||
unsigned int bitsPerSample;
|
unsigned int bitsPerSample;
|
||||||
unsigned int channel;
|
unsigned int channel;
|
||||||
|
bool reconnect;
|
||||||
const char * device;
|
const char * device;
|
||||||
|
|
||||||
// the [general] section
|
// the [general] section
|
||||||
|
@ -139,6 +140,8 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
duration = Util::strToL( str);
|
duration = Util::strToL( str);
|
||||||
str = cs->getForSure( "bufferSecs", " missing in section [general]");
|
str = cs->getForSure( "bufferSecs", " missing in section [general]");
|
||||||
bufferSecs = Util::strToL( str);
|
bufferSecs = Util::strToL( str);
|
||||||
|
str = cs->get( "reconnect");
|
||||||
|
reconnect = str ? (Util::strEq( str, "yes") ? true : false) : true;
|
||||||
|
|
||||||
|
|
||||||
// the [input] section
|
// the [input] section
|
||||||
|
@ -158,7 +161,7 @@ DarkIce :: init ( const Config & config ) throw ( Exception )
|
||||||
sampleRate,
|
sampleRate,
|
||||||
bitsPerSample,
|
bitsPerSample,
|
||||||
channel );
|
channel );
|
||||||
encConnector = new MultiThreadedConnector( dsp.get());
|
encConnector = new MultiThreadedConnector( dsp.get(), reconnect );
|
||||||
|
|
||||||
noAudioOuts = 0;
|
noAudioOuts = 0;
|
||||||
configIceCast( config, bufferSecs);
|
configIceCast( config, bufferSecs);
|
||||||
|
@ -1008,6 +1011,9 @@ DarkIce :: run ( void ) throw ( Exception )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.43 2005/04/11 19:27:43 darkeye
|
||||||
|
added option to turn off automatic reconnect feature
|
||||||
|
|
||||||
Revision 1.42 2005/04/04 08:36:17 darkeye
|
Revision 1.42 2005/04/04 08:36:17 darkeye
|
||||||
commited changes to enable Jack support
|
commited changes to enable Jack support
|
||||||
thanks to Nicholas J. Humfrey, njh@ecs.soton.ac.uk
|
thanks to Nicholas J. Humfrey, njh@ecs.soton.ac.uk
|
||||||
|
|
|
@ -64,8 +64,10 @@ static const char fileid[] = "$Id$";
|
||||||
* Initialize the object
|
* Initialize the object
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
MultiThreadedConnector :: init ( void ) throw ( Exception )
|
MultiThreadedConnector :: init ( bool reconnect ) throw ( Exception )
|
||||||
{
|
{
|
||||||
|
this->reconnect = reconnect;
|
||||||
|
|
||||||
pthread_mutex_init( &mutexProduce, 0);
|
pthread_mutex_init( &mutexProduce, 0);
|
||||||
pthread_cond_init( &condProduce, 0);
|
pthread_cond_init( &condProduce, 0);
|
||||||
threads = 0;
|
threads = 0;
|
||||||
|
@ -96,6 +98,7 @@ MultiThreadedConnector :: MultiThreadedConnector (
|
||||||
throw ( Exception )
|
throw ( Exception )
|
||||||
: Connector( connector)
|
: Connector( connector)
|
||||||
{
|
{
|
||||||
|
reconnect = connector.reconnect;
|
||||||
mutexProduce = connector.mutexProduce;
|
mutexProduce = connector.mutexProduce;
|
||||||
condProduce = connector.condProduce;
|
condProduce = connector.condProduce;
|
||||||
|
|
||||||
|
@ -119,6 +122,7 @@ MultiThreadedConnector :: operator= ( const MultiThreadedConnector & connector )
|
||||||
if ( this != &connector ) {
|
if ( this != &connector ) {
|
||||||
Connector::operator=( connector);
|
Connector::operator=( connector);
|
||||||
|
|
||||||
|
reconnect = connector.reconnect;
|
||||||
mutexProduce = connector.mutexProduce;
|
mutexProduce = connector.mutexProduce;
|
||||||
condProduce = connector.condProduce;
|
condProduce = connector.condProduce;
|
||||||
|
|
||||||
|
@ -310,6 +314,7 @@ MultiThreadedConnector :: sinkThread( int ixSink )
|
||||||
pthread_mutex_unlock( &mutexProduce);
|
pthread_mutex_unlock( &mutexProduce);
|
||||||
|
|
||||||
if ( !threadData->accepting ) {
|
if ( !threadData->accepting ) {
|
||||||
|
if ( reconnect ) {
|
||||||
// if we're not accepting, try to reopen the sink
|
// if we're not accepting, try to reopen the sink
|
||||||
try {
|
try {
|
||||||
sink->close();
|
sink->close();
|
||||||
|
@ -318,6 +323,10 @@ MultiThreadedConnector :: sinkThread( int ixSink )
|
||||||
} catch ( Exception & e ) {
|
} catch ( Exception & e ) {
|
||||||
// don't care, just try and try again
|
// don't care, just try and try again
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// if !reconnect, just stop the connector
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,6 +375,9 @@ MultiThreadedConnector :: ThreadData :: threadFunction( void * param )
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.5 2005/04/11 19:27:43 darkeye
|
||||||
|
added option to turn off automatic reconnect feature
|
||||||
|
|
||||||
Revision 1.4 2004/01/07 13:18:17 darkeye
|
Revision 1.4 2004/01/07 13:18:17 darkeye
|
||||||
commited patch sent by John Hay, fixing FreeBSD problems
|
commited patch sent by John Hay, fixing FreeBSD problems
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,12 @@ class MultiThreadedConnector : public virtual Connector
|
||||||
*/
|
*/
|
||||||
bool running;
|
bool running;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to show if the connector should try to reconnect if
|
||||||
|
* the connection is dropped on the other side.
|
||||||
|
*/
|
||||||
|
bool reconnect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The buffer of information presented to each thread.
|
* The buffer of information presented to each thread.
|
||||||
*/
|
*/
|
||||||
|
@ -169,10 +175,13 @@ class MultiThreadedConnector : public virtual Connector
|
||||||
/**
|
/**
|
||||||
* Initialize the object.
|
* Initialize the object.
|
||||||
*
|
*
|
||||||
|
* @param reconnect flag to indicate if the connector should
|
||||||
|
* try to reconnect if the connection was
|
||||||
|
* dropped by the other end
|
||||||
* @exception Exception
|
* @exception Exception
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
init ( void ) throw ( Exception );
|
init ( bool reconnect ) throw ( Exception );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* De-initialize the object.
|
* De-initialize the object.
|
||||||
|
@ -202,14 +211,18 @@ class MultiThreadedConnector : public virtual Connector
|
||||||
* Constructor based on a Source.
|
* Constructor based on a Source.
|
||||||
*
|
*
|
||||||
* @param source the source to connect to the sinks.
|
* @param source the source to connect to the sinks.
|
||||||
|
* @param reconnect flag to indicate if the connector should
|
||||||
|
* try to reconnect if the connection was
|
||||||
|
* dropped by the other end
|
||||||
* @exception Exception
|
* @exception Exception
|
||||||
*/
|
*/
|
||||||
inline
|
inline
|
||||||
MultiThreadedConnector ( Source * source )
|
MultiThreadedConnector ( Source * source,
|
||||||
|
bool reconnect )
|
||||||
throw ( Exception )
|
throw ( Exception )
|
||||||
: Connector( source )
|
: Connector( source )
|
||||||
{
|
{
|
||||||
init();
|
init(reconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,15 +230,19 @@ class MultiThreadedConnector : public virtual Connector
|
||||||
*
|
*
|
||||||
* @param source the source to connect to the sinks.
|
* @param source the source to connect to the sinks.
|
||||||
* @param sink a sink to connect to the source.
|
* @param sink a sink to connect to the source.
|
||||||
|
* @param reconnect flag to indicate if the connector should
|
||||||
|
* try to reconnect if the connection was
|
||||||
|
* dropped by the other end
|
||||||
* @exception Exception
|
* @exception Exception
|
||||||
*/
|
*/
|
||||||
inline
|
inline
|
||||||
MultiThreadedConnector ( Source * source,
|
MultiThreadedConnector ( Source * source,
|
||||||
Sink * sink )
|
Sink * sink,
|
||||||
|
bool reconnect )
|
||||||
throw ( Exception )
|
throw ( Exception )
|
||||||
: Connector( source, sink)
|
: Connector( source, sink)
|
||||||
{
|
{
|
||||||
init();
|
init(reconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -330,6 +347,9 @@ class MultiThreadedConnector : public virtual Connector
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.5 2005/04/11 19:27:43 darkeye
|
||||||
|
added option to turn off automatic reconnect feature
|
||||||
|
|
||||||
Revision 1.4 2004/02/23 19:12:52 darkeye
|
Revision 1.4 2004/02/23 19:12:52 darkeye
|
||||||
ported to NetBSD
|
ported to NetBSD
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue