fix 503 was right, my mistake in r515...
This commit is contained in:
parent
95fe8f1ab9
commit
79820cba1d
|
@ -61,8 +61,7 @@ CastSink :: init ( TcpSocket * socket,
|
||||||
const char * name,
|
const char * name,
|
||||||
const char * url,
|
const char * url,
|
||||||
const char * genre,
|
const char * genre,
|
||||||
bool isPublic,
|
bool isPublic )
|
||||||
unsigned int bufferDuration )
|
|
||||||
throw ( Exception )
|
throw ( Exception )
|
||||||
{
|
{
|
||||||
this->socket = socket;
|
this->socket = socket;
|
||||||
|
@ -73,13 +72,6 @@ CastSink :: init ( TcpSocket * socket,
|
||||||
this->url = url ? Util::strDup( url) : 0;
|
this->url = url ? Util::strDup( url) : 0;
|
||||||
this->genre = genre ? Util::strDup( genre) : 0;
|
this->genre = genre ? Util::strDup( genre) : 0;
|
||||||
this->isPublic = isPublic;
|
this->isPublic = isPublic;
|
||||||
this->bufferDuration = bufferDuration;
|
|
||||||
|
|
||||||
int bufferSize = bitRate ? (bitRate * 1024 / 8) * bufferDuration
|
|
||||||
: (128 * 1024 / 8) * bufferDuration;
|
|
||||||
|
|
||||||
bufferedSink = socket ? new BufferedSink( socket, bufferSize)
|
|
||||||
: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +110,7 @@ CastSink :: open ( void ) throw ( Exception )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !bufferedSink->open() ) {
|
if ( !getSink()->open() ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,21 +68,11 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
*/
|
*/
|
||||||
Ref<TcpSocket> socket;
|
Ref<TcpSocket> socket;
|
||||||
|
|
||||||
/**
|
|
||||||
* The BufferedSink encapsulating the socket connection to the server.
|
|
||||||
*/
|
|
||||||
Ref<BufferedSink> bufferedSink;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An optional Sink to enable stream dumps.
|
* An optional Sink to enable stream dumps.
|
||||||
*/
|
*/
|
||||||
Ref<Sink> streamDump;
|
Ref<Sink> streamDump;
|
||||||
|
|
||||||
/**
|
|
||||||
* Duration of the BufferedSink buffer in seconds.
|
|
||||||
*/
|
|
||||||
unsigned int bufferDuration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password to the server.
|
* Password to the server.
|
||||||
*/
|
*/
|
||||||
|
@ -123,8 +113,6 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
* @param genre genre of the stream.
|
* @param genre genre of the stream.
|
||||||
* @param bitRate bitrate of the stream (e.g. mp3 bitrate).
|
* @param bitRate bitrate of the stream (e.g. mp3 bitrate).
|
||||||
* @param isPublic is the stream public?
|
* @param isPublic is the stream public?
|
||||||
* @param bufferDuration duration of the BufferedSink buffer
|
|
||||||
* in seconds.
|
|
||||||
* @exception Exception
|
* @exception Exception
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
@ -135,8 +123,7 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
const char * name,
|
const char * name,
|
||||||
const char * url,
|
const char * url,
|
||||||
const char * genre,
|
const char * genre,
|
||||||
bool isPublic,
|
bool isPublic)
|
||||||
unsigned int bufferDuration )
|
|
||||||
throw ( Exception );
|
throw ( Exception );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,7 +165,7 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
inline Sink *
|
inline Sink *
|
||||||
getSink ( void ) const throw ()
|
getSink ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return bufferedSink.get();
|
return getSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,8 +193,7 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
* @param bitRate bitrate of the stream (e.g. mp3 bitrate).
|
* @param bitRate bitrate of the stream (e.g. mp3 bitrate).
|
||||||
* @param isPublic is the stream public?
|
* @param isPublic is the stream public?
|
||||||
* @param streamDump a Sink to dump the streamed binary data to
|
* @param streamDump a Sink to dump the streamed binary data to
|
||||||
* @param bufferDuration duration of the BufferedSink buffer
|
*
|
||||||
* in seconds.
|
|
||||||
* @exception Exception
|
* @exception Exception
|
||||||
*/
|
*/
|
||||||
inline
|
inline
|
||||||
|
@ -218,8 +204,7 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
const char * url = 0,
|
const char * url = 0,
|
||||||
const char * genre = 0,
|
const char * genre = 0,
|
||||||
bool isPublic = false,
|
bool isPublic = false,
|
||||||
Sink * streamDump = 0,
|
Sink * streamDump = 0)
|
||||||
unsigned int bufferDuration = 10 )
|
|
||||||
throw ( Exception )
|
throw ( Exception )
|
||||||
{
|
{
|
||||||
init( socket,
|
init( socket,
|
||||||
|
@ -229,8 +214,7 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
name,
|
name,
|
||||||
url,
|
url,
|
||||||
genre,
|
genre,
|
||||||
isPublic,
|
isPublic );
|
||||||
bufferDuration );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,8 +233,7 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
cs.name,
|
cs.name,
|
||||||
cs.url,
|
cs.url,
|
||||||
cs.genre,
|
cs.genre,
|
||||||
cs.isPublic,
|
cs.isPublic );
|
||||||
cs.bufferDuration );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -284,8 +267,7 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
cs.name,
|
cs.name,
|
||||||
cs.url,
|
cs.url,
|
||||||
cs.genre,
|
cs.genre,
|
||||||
cs.isPublic,
|
cs.isPublic );
|
||||||
cs.bufferDuration );
|
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +290,11 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
inline virtual bool
|
inline virtual bool
|
||||||
isOpen ( void ) const throw ()
|
isOpen ( void ) const throw ()
|
||||||
{
|
{
|
||||||
return bufferedSink != NULL ? bufferedSink->isOpen() : false;
|
Sink *s = getSink();
|
||||||
|
if (s)
|
||||||
|
return getSink()->isOpen();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -455,17 +441,6 @@ class CastSink : public Sink, public virtual Reporter
|
||||||
{
|
{
|
||||||
return isPublic;
|
return isPublic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the duration of the BufferedSink buffer in seconds.
|
|
||||||
*
|
|
||||||
* @return the the duration of the BufferedSink buffer in seconds.
|
|
||||||
*/
|
|
||||||
inline unsigned int
|
|
||||||
getBufferDuration ( void ) const throw ()
|
|
||||||
{
|
|
||||||
return bufferDuration;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue