From 1116eee6819e3be82837385aaa1cecaedf8b4f70 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Tue, 15 Jan 2013 17:31:25 -0300 Subject: [PATCH] mssdemux: push newsegments with same start time on bitrate switches This keeps sinks working in sync after a bitrate switch --- ext/smoothstreaming/gstmssdemux.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ext/smoothstreaming/gstmssdemux.c b/ext/smoothstreaming/gstmssdemux.c index a596726c67..45a353f968 100644 --- a/ext/smoothstreaming/gstmssdemux.c +++ b/ext/smoothstreaming/gstmssdemux.c @@ -780,6 +780,7 @@ gst_mss_demux_reconfigure (GstMssDemux * mssdemux) gst_mss_demux_stop_tasks (mssdemux, TRUE); if (gst_mss_manifest_change_bitrate (mssdemux->manifest, mssdemux->connection_speed)) { + GstClockTime newseg_ts = GST_CLOCK_TIME_NONE; GST_DEBUG_OBJECT (mssdemux, "Creating new pad group"); /* if we changed the bitrate, we need to add new pads */ @@ -819,6 +820,9 @@ gst_mss_demux_reconfigure (GstMssDemux * mssdemux) (stream->manifest_stream); } + if (ts < newseg_ts) + newseg_ts = ts; + GST_DEBUG_OBJECT (mssdemux, "Seeking stream %p %s to ts %" GST_TIME_FORMAT, stream, GST_PAD_NAME (stream->pad), GST_TIME_ARGS (ts)); @@ -840,6 +844,13 @@ gst_mss_demux_reconfigure (GstMssDemux * mssdemux) gst_element_remove_pad (GST_ELEMENT (mssdemux), oldpad); gst_object_unref (oldpad); } + for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) { + GstMssDemuxStream *stream = iter->data; + + stream->pending_newsegment = + gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_TIME, newseg_ts, -1, + newseg_ts); + } } gst_mss_demux_restart_tasks (mssdemux); } -- 2.34.1