+2007-02-09 Tim-Philipp Müller <tim at centricular dot net>
+
+ * 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).
+
2007-02-09 Stefan Kost <ensonic@users.sf.net>
* gst/synaesthesia/gstsynaesthesia.c:
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,
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);
}
}
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));
}
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;
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 */
static GstFlowReturn
gst_mp3parse_chain (GstPad * pad, GstBuffer * buf)
{
+ GstFlowReturn flow = GST_FLOW_OK;
GstMPEGAudioParse *mp3parse;
const guchar *data;
guint32 header;
GstClockTime timestamp;
guint available;
- mp3parse = GST_MP3PARSE (gst_pad_get_parent (pad));
+ mp3parse = GST_MP3PARSE (GST_PAD_PARENT (pad));
- GST_DEBUG_OBJECT (mp3parse, "received buffer of %d bytes",
- GST_BUFFER_SIZE (buf));
+ GST_LOG_OBJECT (mp3parse, "buffer of %d bytes", GST_BUFFER_SIZE (buf));
timestamp = GST_BUFFER_TIMESTAMP (buf);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (mp3parse->srcpad));
- gst_pad_push (mp3parse->srcpad, outbuf);
+ flow = gst_pad_push (mp3parse->srcpad, outbuf);
} else {
GST_DEBUG_OBJECT (mp3parse, "skipping buffer of %d bytes",
gst_adapter_flush (mp3parse->adapter, 1);
GST_DEBUG_OBJECT (mp3parse, "wrong header, skipping byte");
}
- }
- gst_object_unref (mp3parse);
+ if (GST_FLOW_IS_FATAL (flow))
+ break;
+ }
- return GST_FLOW_OK;
+ return flow;
}
static gboolean