Accept data until next Ogg packet is ready in VorbisEncoder#canWrite

This commit is contained in:
alban.peignier@gmail.com 2013-07-21 18:42:47 +00:00
parent 93cea2772e
commit e0cad73a68
1 changed files with 14 additions and 11 deletions

View File

@ -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 */