- if (changed) {
- GstClockTime newseg_ts = GST_CLOCK_TIME_NONE;
-
- GST_DEBUG_OBJECT (mssdemux,
- "Bitrates have changed, creating new pad group");
- /* if we changed the bitrate, we need to add new pads */
- for (iter = mssdemux->streams; iter; iter = g_slist_next (iter)) {
- GstMssDemuxStream *stream = iter->data;
- GstPad *oldpad = stream->pad;
- GstClockTime ts = GST_CLOCK_TIME_NONE;
-
- if (oldpad)
- oldpads = g_slist_prepend (oldpads, oldpad);
-
- /* since we are flushing the queue, get the next un-pushed timestamp to seek
- * and avoid gaps */
- gst_data_queue_set_flushing (stream->dataqueue, FALSE);
- if (!gst_data_queue_is_empty (stream->dataqueue)) {
- GstDataQueueItem *item = NULL;
-
- while (!gst_data_queue_is_empty (stream->dataqueue)
- && !GST_CLOCK_TIME_IS_VALID (ts)) {
- gst_data_queue_pop (stream->dataqueue, &item);
-
- if (!item) {
- g_assert_not_reached ();
- break;
- }
-
- if (GST_IS_BUFFER (item->object)) {
- GstBuffer *buffer = GST_BUFFER_CAST (item->object);
-
- ts = GST_BUFFER_TIMESTAMP (buffer);
- }
- item->destroy (item);
- }
-
- }
- if (!GST_CLOCK_TIME_IS_VALID (ts)) {
- ts = gst_mss_stream_get_fragment_gst_timestamp
- (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));
- gst_mss_stream_seek (stream->manifest_stream, ts);
- gst_data_queue_flush (stream->dataqueue);
-
- stream->pad = _create_pad (mssdemux, stream->manifest_stream);
- gst_mss_demux_expose_stream (mssdemux, stream);
-
- stream->have_data = FALSE;
- }
-
- gst_element_no_more_pads (GST_ELEMENT (mssdemux));
-
- for (iter = oldpads; iter; iter = g_slist_next (iter)) {
- GstPad *oldpad = iter->data;
-
- gst_pad_push_event (oldpad, gst_event_new_eos ());
- gst_pad_set_active (oldpad, FALSE);
- 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);