mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
ext/lame/gstlame.c: Don't crash if we get an EOS event before the encoder has been set up (#339287).
Original commit message from CVS: Patch by: Ed Catmur <ed at catmur dot co dot uk> * ext/lame/gstlame.c: (gst_lame_sink_event): Don't crash if we get an EOS event before the encoder has been set up (#339287).
This commit is contained in:
parent
349b97c161
commit
a0f4d95e0b
2 changed files with 25 additions and 13 deletions
|
@ -1,3 +1,11 @@
|
|||
2006-04-21 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Patch by: Ed Catmur <ed at catmur dot co dot uk>
|
||||
|
||||
* ext/lame/gstlame.c: (gst_lame_sink_event):
|
||||
Don't crash if we get an EOS event before the encoder
|
||||
has been set up (#339287).
|
||||
|
||||
2006-04-21 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_start),
|
||||
|
|
|
@ -951,20 +951,24 @@ gst_lame_sink_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:{
|
||||
GstBuffer *buf;
|
||||
gint size;
|
||||
|
||||
GST_DEBUG_OBJECT (lame, "handling EOS event");
|
||||
buf = gst_buffer_new_and_alloc (7200);
|
||||
size = lame_encode_flush (lame->lgf, GST_BUFFER_DATA (buf), 7200);
|
||||
if (size > 0) {
|
||||
GST_BUFFER_SIZE (buf) = size;
|
||||
GST_DEBUG_OBJECT (lame, "pushing final packet of %u bytes", size);
|
||||
gst_buffer_set_caps (buf, GST_PAD_CAPS (lame->srcpad));
|
||||
gst_pad_push (lame->srcpad, buf);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (lame, "no final packet (size=%d)", size);
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
if (lame->lgf != NULL) {
|
||||
GstBuffer *buf;
|
||||
gint size;
|
||||
|
||||
buf = gst_buffer_new_and_alloc (7200);
|
||||
size = lame_encode_flush (lame->lgf, GST_BUFFER_DATA (buf), 7200);
|
||||
|
||||
if (size > 0) {
|
||||
GST_BUFFER_SIZE (buf) = size;
|
||||
GST_DEBUG_OBJECT (lame, "pushing final packet of %u bytes", size);
|
||||
gst_buffer_set_caps (buf, GST_PAD_CAPS (lame->srcpad));
|
||||
gst_pad_push (lame->srcpad, buf);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (lame, "no final packet (size=%d)", size);
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
}
|
||||
|
||||
ret = gst_pad_event_default (pad, event);
|
||||
|
|
Loading…
Reference in a new issue