From ccd4d54df83be76026d34ed2c5a4c009e1ee5e49 Mon Sep 17 00:00:00 2001 From: "rafael@riseup.net" Date: Thu, 6 May 2010 20:19:18 +0000 Subject: [PATCH] bug fix for an old bug in BufferedSink.cpp --- darkice/trunk/AUTHORS | 1 + darkice/trunk/ChangeLog | 6 +++++- darkice/trunk/src/BufferedSink.cpp | 11 ++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/darkice/trunk/AUTHORS b/darkice/trunk/AUTHORS index 674c97e..dec1fee 100644 --- a/darkice/trunk/AUTHORS +++ b/darkice/trunk/AUTHORS @@ -41,3 +41,4 @@ with contributions by: Roland Hermans Sergiy Clemens Ladisch + Edwin van den Oetelaar diff --git a/darkice/trunk/ChangeLog b/darkice/trunk/ChangeLog index d812df6..81cac5f 100644 --- a/darkice/trunk/ChangeLog +++ b/darkice/trunk/ChangeLog @@ -1,14 +1,18 @@ Next release + o fixed a bug in BufferedSink.cpp that leads to some buffers + being written twice, causing corruption of datastream, + thanks to Edwin van den Oetelaar o implemented samplerate conversion for all codecs using libsamplerate, and keeping internal aflibConverter as fallback, thanks to Sergiy o bugfix: fix for alsa driver - closes ticked #8 thanks to Clemens Ladisch + 14-11-2009 Darkice 0.20.1 released o added rc.darkice init script thanks to Niels Dettenbach o bugfix: fix for gcc 4.4 - + 05-11-2009 Darkice 0.20 released o new maintainer: Rafael Diniz diff --git a/darkice/trunk/src/BufferedSink.cpp b/darkice/trunk/src/BufferedSink.cpp index aabbadd..f27b774 100644 --- a/darkice/trunk/src/BufferedSink.cpp +++ b/darkice/trunk/src/BufferedSink.cpp @@ -330,10 +330,15 @@ BufferedSink :: write ( const void * buf, // the internal buffer is empty, try to write the fresh data soFar = 0; - if ( inp != outp ) { + if ( inp == outp ) { while ( soFar < len && sink->canWrite( 0, 0) ) { - soFar += sink->write( b + soFar, len - soFar); - } + try { + soFar += sink->write( b + soFar, len - soFar); + } catch (Exception &e) { + reportEvent(3,"Exception caught in BufferedSink :: write3\n"); + throw; /* up a level */ + } + } } length = soFar;