From e0cad73a683b868f05db28834afdd94401f5963d Mon Sep 17 00:00:00 2001 From: "alban.peignier@gmail.com" Date: Sun, 21 Jul 2013 18:42:47 +0000 Subject: [PATCH] Accept data until next Ogg packet is ready in VorbisEncoder#canWrite --- darkice/trunk/src/VorbisLibEncoder.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/darkice/trunk/src/VorbisLibEncoder.h b/darkice/trunk/src/VorbisLibEncoder.h index 06f9de0..bf18ee8 100644 --- a/darkice/trunk/src/VorbisLibEncoder.h +++ b/darkice/trunk/src/VorbisLibEncoder.h @@ -8,19 +8,19 @@ Version : $Revision$ Author : $Author$ Location : $HeadURL$ - + Copyright notice: This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -211,11 +211,11 @@ class VorbisLibEncoder : public AudioEncoder, public virtual Reporter unsigned int outChannel = 0, unsigned int outMaxBitrate = 0 ) throw ( Exception ) - + : AudioEncoder ( sink, inSampleRate, inBitsPerSample, - inChannel, + inChannel, inBigEndian, outBitrateMode, outBitrate, @@ -253,7 +253,7 @@ class VorbisLibEncoder : public AudioEncoder, public virtual Reporter unsigned int outChannel = 0, unsigned int outMaxBitrate = 0 ) throw ( Exception ) - + : AudioEncoder ( sink, as, outBitrateMode, @@ -402,7 +402,11 @@ class VorbisLibEncoder : public AudioEncoder, public virtual Reporter return false; } - return getSink()->canWrite(sec, usec); + if ( 1 == vorbis_analysis_blockout( &vorbisDspState, &vorbisBlock) ) { + return getSink()->canWrite(sec, usec); + } else { + return true; + } } /** @@ -447,4 +451,3 @@ class VorbisLibEncoder : public AudioEncoder, public virtual Reporter #endif /* VORBIS_LIB_ENCODER_H */ -