ext/vorbis/vorbisenc.c: If we get a zero-sized input buffer, don't pass it to libvorbis, as that marks EOS internally...

Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_chain):
If we get a zero-sized input buffer, don't pass it to libvorbis, as
that marks EOS internally. After that, libvorbis will buffer all
input data, and encode none of it, eventually leading to memory
exhaustion.
This commit is contained in:
Michael Smith 2007-03-20 11:49:55 +00:00
parent d24780a03b
commit 45b6d734ec
2 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2007-03-20 Michael Smith <msmith@fluendo.com>
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_chain):
If we get a zero-sized input buffer, don't pass it to libvorbis, as
that marks EOS internally. After that, libvorbis will buffer all
input data, and encode none of it, eventually leading to memory
exhaustion.
2007-03-19 Wim Taymans <wim@fluendo.com>
* gst/playback/gstdecodebin.c: (remove_fakesink):

View file

@ -1149,6 +1149,12 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
vorbisenc->next_discont = TRUE;
}
/* Sending zero samples to libvorbis marks EOS, so we mustn't do that */
if (GST_BUFFER_SIZE (buffer) == 0) {
gst_buffer_unref (buffer);
return GST_FLOW_OK;
}
/* data to encode */
data = (gfloat *) GST_BUFFER_DATA (buffer);
size = GST_BUFFER_SIZE (buffer) / (vorbisenc->channels * sizeof (float));