Still trying to stabilize Opus

This commit is contained in:
rafael@riseup.net 2013-05-20 00:48:09 +00:00
parent 9a120dc16b
commit ebb798f0ef
2 changed files with 5 additions and 1 deletions

View File

@ -163,6 +163,8 @@ OpusLibEncoder :: open ( void )
internalBufferLength = 0; internalBufferLength = 0;
memset( internalBuffer, 0, bufferSize); memset( internalBuffer, 0, bufferSize);
reconnectError = false;
int err; int err;
opusEncoder = opus_encoder_create( getOutSampleRate(), opusEncoder = opus_encoder_create( getOutSampleRate(),
getInChannel(), getInChannel(),
@ -467,7 +469,7 @@ void
OpusLibEncoder :: flush ( void ) OpusLibEncoder :: flush ( void )
throw ( Exception ) throw ( Exception )
{ {
if ( !isOpen() || encoderOpen == false ) { if ( !isOpen() || reconnectError == true ) {
return; return;
} }
@ -522,6 +524,7 @@ OpusLibEncoder :: opusBlocksOut ( int bytes,
written += getSink()->write( oggPage.body, oggPage.body_len); written += getSink()->write( oggPage.body, oggPage.body_len);
if ( written < oggPage.header_len + oggPage.body_len ) { if ( written < oggPage.header_len + oggPage.body_len ) {
reconnectError = true;
// just let go data that could not be written // just let go data that could not be written
reportEvent( 2, reportEvent( 2,
"couldn't write full opus data to underlying sink", "couldn't write full opus data to underlying sink",

View File

@ -216,6 +216,7 @@ class OpusLibEncoder : public AudioEncoder, public virtual Reporter
unsigned char* internalBuffer; unsigned char* internalBuffer;
int internalBufferLength; int internalBufferLength;
bool reconnectError;
/** /**
* Maximum bitrate of the output in kbits/sec. If 0, don't care. * Maximum bitrate of the output in kbits/sec. If 0, don't care.