From ebb798f0efe46cb4737e94a3a63b6d2e3b34f47b Mon Sep 17 00:00:00 2001 From: "rafael@riseup.net" Date: Mon, 20 May 2013 00:48:09 +0000 Subject: [PATCH] Still trying to stabilize Opus --- darkice/trunk/src/OpusLibEncoder.cpp | 5 ++++- darkice/trunk/src/OpusLibEncoder.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/darkice/trunk/src/OpusLibEncoder.cpp b/darkice/trunk/src/OpusLibEncoder.cpp index 73608ef..f9e05e6 100644 --- a/darkice/trunk/src/OpusLibEncoder.cpp +++ b/darkice/trunk/src/OpusLibEncoder.cpp @@ -163,6 +163,8 @@ OpusLibEncoder :: open ( void ) internalBufferLength = 0; memset( internalBuffer, 0, bufferSize); + reconnectError = false; + int err; opusEncoder = opus_encoder_create( getOutSampleRate(), getInChannel(), @@ -467,7 +469,7 @@ void OpusLibEncoder :: flush ( void ) throw ( Exception ) { - if ( !isOpen() || encoderOpen == false ) { + if ( !isOpen() || reconnectError == true ) { return; } @@ -522,6 +524,7 @@ OpusLibEncoder :: opusBlocksOut ( int bytes, written += getSink()->write( oggPage.body, oggPage.body_len); if ( written < oggPage.header_len + oggPage.body_len ) { + reconnectError = true; // just let go data that could not be written reportEvent( 2, "couldn't write full opus data to underlying sink", diff --git a/darkice/trunk/src/OpusLibEncoder.h b/darkice/trunk/src/OpusLibEncoder.h index 86d1cd8..d53a46d 100644 --- a/darkice/trunk/src/OpusLibEncoder.h +++ b/darkice/trunk/src/OpusLibEncoder.h @@ -216,6 +216,7 @@ class OpusLibEncoder : public AudioEncoder, public virtual Reporter unsigned char* internalBuffer; int internalBufferLength; + bool reconnectError; /** * Maximum bitrate of the output in kbits/sec. If 0, don't care.