From ee8a5455d0b04198e90670ea672859cc30a1ad48 Mon Sep 17 00:00:00 2001 From: Vineeth TM Date: Thu, 24 Dec 2015 15:36:54 +0900 Subject: [PATCH] mpegtsbase: Refactor code to check for subclass seek handling If subclass is not able to handle seek event, then there is no need to stop streaming and send flush events. We should simply return FALSE https://bugzilla.gnome.org/show_bug.cgi?id=758516 --- gst/mpegtsdemux/mpegtsbase.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index 1265669..d63122f 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -1433,11 +1433,18 @@ mpegts_base_handle_seek_event (MpegTSBase * base, GstPad * pad, } base->mode = BASE_MODE_PUSHING; } + } else { + GST_WARNING ("subclass has no seek implementation"); } return ret == GST_FLOW_OK; } + if (!klass->seek) { + GST_WARNING ("subclass has no seek implementation"); + return FALSE; + } + if (rate <= 0.0) { GST_WARNING ("Negative rate not supported"); return FALSE; @@ -1484,16 +1491,11 @@ mpegts_base_handle_seek_event (MpegTSBase * base, GstPad * pad, /* If the subclass can seek, do that */ - if (klass->seek) { - ret = klass->seek (base, event); - if (G_UNLIKELY (ret != GST_FLOW_OK)) - GST_WARNING ("seeking failed %s", gst_flow_get_name (ret)); - else - base->last_seek_seqnum = GST_EVENT_SEQNUM (event); - } else { - /* FIXME : Check this before so we don't do seeks we can't handle ? */ - GST_WARNING ("subclass has no seek implementation"); - } + ret = klass->seek (base, event); + if (G_UNLIKELY (ret != GST_FLOW_OK)) + GST_WARNING ("seeking failed %s", gst_flow_get_name (ret)); + else + base->last_seek_seqnum = GST_EVENT_SEQNUM (event); if (flush_event) { /* if we sent a FLUSH_START, we now send a FLUSH_STOP */ -- 2.7.4