mssdemux: push newsegments with same start time on bitrate switches

This keeps sinks working in sync after a bitrate switch
This commit is contained in:
Thiago Santos 2013-01-15 17:31:25 -03:00
parent c2ae981e6d
commit 1116eee681

View file

@ -780,6 +780,7 @@ gst_mss_demux_reconfigure (GstMssDemux * mssdemux)
gst_mss_demux_stop_tasks (mssdemux, TRUE); gst_mss_demux_stop_tasks (mssdemux, TRUE);
if (gst_mss_manifest_change_bitrate (mssdemux->manifest, if (gst_mss_manifest_change_bitrate (mssdemux->manifest,
mssdemux->connection_speed)) { mssdemux->connection_speed)) {
GstClockTime newseg_ts = GST_CLOCK_TIME_NONE;
GST_DEBUG_OBJECT (mssdemux, "Creating new pad group"); GST_DEBUG_OBJECT (mssdemux, "Creating new pad group");
/* if we changed the bitrate, we need to add new pads */ /* if we changed the bitrate, we need to add new pads */
@ -819,6 +820,9 @@ gst_mss_demux_reconfigure (GstMssDemux * mssdemux)
(stream->manifest_stream); (stream->manifest_stream);
} }
if (ts < newseg_ts)
newseg_ts = ts;
GST_DEBUG_OBJECT (mssdemux, GST_DEBUG_OBJECT (mssdemux,
"Seeking stream %p %s to ts %" GST_TIME_FORMAT, stream, "Seeking stream %p %s to ts %" GST_TIME_FORMAT, stream,
GST_PAD_NAME (stream->pad), GST_TIME_ARGS (ts)); 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_element_remove_pad (GST_ELEMENT (mssdemux), oldpad);
gst_object_unref (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); gst_mss_demux_restart_tasks (mssdemux);
} }