mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
ext/lame/gstlame.*: On receiving EOS, we try to push a last buffer with the remaining samples. Don't do that if we go...
Original commit message from CVS: * ext/lame/gstlame.c: (gst_lame_sink_event), (gst_lame_chain), (gst_lame_change_state): * ext/lame/gstlame.h: On receiving EOS, we try to push a last buffer with the remaining samples. Don't do that if we got an unclean flow return on the last gst_pad_push(), downstream might not handle this very gracefully (see #403168). * gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_chain): Pass flow returns upstream (helps #403168).
This commit is contained in:
parent
26ee17bc28
commit
16c774ff13
2 changed files with 8 additions and 2 deletions
|
@ -920,7 +920,7 @@ gst_lame_sink_event (GstPad * pad, GstEvent * event)
|
|||
buf = gst_buffer_new_and_alloc (7200);
|
||||
size = lame_encode_flush (lame->lgf, GST_BUFFER_DATA (buf), 7200);
|
||||
|
||||
if (size > 0) {
|
||||
if (size > 0 && lame->last_flow == GST_FLOW_OK) {
|
||||
gint64 duration;
|
||||
|
||||
duration = gst_util_uint64_scale_int (size, GST_SECOND,
|
||||
|
@ -941,7 +941,8 @@ gst_lame_sink_event (GstPad * pad, GstEvent * event)
|
|||
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_DEBUG_OBJECT (lame, "no final packet (size=%d, last_flow=%s)",
|
||||
size, gst_flow_get_name (lame->last_flow));
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
}
|
||||
|
@ -1064,6 +1065,7 @@ gst_lame_chain (GstPad * pad, GstBuffer * buf)
|
|||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (lame->srcpad));
|
||||
|
||||
result = gst_pad_push (lame->srcpad, outbuf);
|
||||
lame->last_flow = result;
|
||||
if (result != GST_FLOW_OK) {
|
||||
GST_DEBUG_OBJECT (lame, "flow return: %s", gst_flow_get_name (result));
|
||||
}
|
||||
|
@ -1201,6 +1203,7 @@ gst_lame_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
lame->last_flow = GST_FLOW_OK;
|
||||
lame->last_ts = GST_CLOCK_TIME_NONE;
|
||||
lame->eos_ts = GST_CLOCK_TIME_NONE;
|
||||
break;
|
||||
|
|
|
@ -93,6 +93,9 @@ struct _GstLame {
|
|||
gboolean emphasis;
|
||||
gint preset;
|
||||
|
||||
/* track this so we don't send a last buffer in eos handler after error */
|
||||
GstFlowReturn last_flow;
|
||||
|
||||
lame_global_flags *lgf;
|
||||
|
||||
/* time tracker */
|
||||
|
|
Loading…
Reference in a new issue