From b7f3a53b5d43c40fc1432c12f2ca314c5dbf403b Mon Sep 17 00:00:00 2001 From: Lyon Wang Date: Fri, 15 Jan 2016 17:30:14 +0800 Subject: [PATCH 4/7] [gstbaseparse] Need push adapter remainning data in pass through mode When switching to pass through mode, there might be remainning data in the adpater, and it will be no chance to push to downstream when in pass through mode. So need check adapter available data and push downstream to avoid missing data package: gstreamer1.0 Upstream-Status: Pending [https://bugzilla.gnome.org/show_bug.cgi?id=760513] Signed-off-by: Lyon Wang --- libs/gst/base/gstbaseparse.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) mode change 100644 => 100755 libs/gst/base/gstbaseparse.c diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c old mode 100644 new mode 100755 index 3c52887..6d3eacf --- a/libs/gst/base/gstbaseparse.c +++ b/libs/gst/base/gstbaseparse.c @@ -3138,6 +3138,21 @@ gst_base_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) && parse->priv->passthrough)) { GstBaseParseFrame frame; + av = gst_adapter_available (parse->priv->adapter); + if (av) { + tmpbuf = gst_adapter_take_buffer (parse->priv->adapter, av); + + if (parse->priv->upstream_format == GST_FORMAT_TIME) { + tmpbuf = gst_buffer_make_writable (tmpbuf); + GST_BUFFER_PTS (tmpbuf) = parse->priv->next_pts; + GST_BUFFER_DTS (tmpbuf) = parse->priv->next_dts; + GST_BUFFER_DURATION (tmpbuf) = GST_CLOCK_TIME_NONE; + } + + ret = gst_pad_push (parse->srcpad, tmpbuf); + + } + gst_base_parse_frame_init (&frame); frame.buffer = gst_buffer_make_writable (buffer); ret = gst_base_parse_push_frame (parse, &frame); -- 1.9.1