gst-plugins-bad: mpegtsmux: don' t error out if downstream fails to handle the newsegment event

Tim Müller tpm at kemper.freedesktop.org
Mon Mar 14 05:50:42 PDT 2011


Module: gst-plugins-bad
Branch: master
Commit: 70e71562b7aee9eaf8002b72beb950a026863847
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=70e71562b7aee9eaf8002b72beb950a026863847

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Mon Mar 14 12:33:29 2011 +0000

mpegtsmux: don't error out if downstream fails to handle the newsegment event

If downstream doesn't handle the newsegment event, don't error out (esp.
not without posting a proper error message on the bus), but just continue.
If there's a problem, we'll find out when we start pushing buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=644395

---

 gst/mpegtsmux/mpegtsmux.c |   26 +++++++-------------------
 1 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c
index f6f12e0..a3c8bb3 100644
--- a/gst/mpegtsmux/mpegtsmux.c
+++ b/gst/mpegtsmux/mpegtsmux.c
@@ -140,7 +140,7 @@ static gboolean new_packet_cb (guint8 * data, guint len, void *user_data,
     gint64 new_pcr);
 static void release_buffer_cb (guint8 * data, void *user_data);
 
-static gboolean mpegtsdemux_prepare_srcpad (MpegTsMux * mux);
+static void mpegtsdemux_prepare_srcpad (MpegTsMux * mux);
 static GstFlowReturn mpegtsmux_collected (GstCollectPads * pads,
     MpegTsMux * mux);
 static GstPad *mpegtsmux_request_new_pad (GstElement * element,
@@ -656,23 +656,18 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux)
 
   GST_DEBUG_OBJECT (mux, "Pads collected");
 
-  if (mux->first) {
+  if (G_UNLIKELY (mux->first)) {
     ret = mpegtsmux_create_streams (mux);
     if (G_UNLIKELY (ret != GST_FLOW_OK))
       return ret;
 
-    best = mpegtsmux_choose_best_stream (mux);
-
-    if (!mpegtsdemux_prepare_srcpad (mux)) {
-      GST_DEBUG_OBJECT (mux, "Failed to send new segment");
-      goto new_seg_fail;
-    }
+    mpegtsdemux_prepare_srcpad (mux);
 
     mux->first = FALSE;
-  } else {
-    best = mpegtsmux_choose_best_stream (mux);
   }
 
+  best = mpegtsmux_choose_best_stream (mux);
+
   if (best != NULL) {
     TsMuxProgram *prog = best->prog;
     GstBuffer *buf = best->queued_buf;
@@ -732,8 +727,6 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux)
   }
 
   return ret;
-new_seg_fail:
-  return GST_FLOW_ERROR;
 write_fail:
   /* FIXME: Failed writing data for some reason. Should set appropriate error */
   return mux->last_flow_ret;
@@ -981,7 +974,7 @@ mpegtsdemux_set_header_on_caps (MpegTsMux * mux)
   gst_caps_unref (caps);
 }
 
-static gboolean
+static void
 mpegtsdemux_prepare_srcpad (MpegTsMux * mux)
 {
   GstEvent *new_seg =
@@ -992,17 +985,12 @@ mpegtsdemux_prepare_srcpad (MpegTsMux * mux)
       (mux->m2ts_mode ? M2TS_PACKET_LENGTH : NORMAL_TS_PACKET_LENGTH),
       NULL);
 
-//      gst_static_pad_template_get_caps (&mpegtsmux_src_factory);
-
   /* Set caps on src pad from our template and push new segment */
   gst_pad_set_caps (mux->srcpad, caps);
 
   if (!gst_pad_push_event (mux->srcpad, new_seg)) {
-    GST_WARNING_OBJECT (mux, "New segment event was not handled");
-    return FALSE;
+    GST_WARNING_OBJECT (mux, "New segment event was not handled downstream");
   }
-
-  return TRUE;
 }
 
 static GstStateChangeReturn



More information about the gstreamer-commits mailing list