+ /* For live streams, check whether the underlying representation changed
+ * (due to a manifest update with no matching representation) */
+ if (gst_mpd_client_is_live (dashdemux->client)
+ && !GST_ADAPTIVE_DEMUX_STREAM_NEED_HEADER (stream)) {
+ if (dashstream->active_stream
+ && dashstream->active_stream->cur_representation) {
+ /* id specifies an identifier for this Representation. The
+ * identifier shall be unique within a Period unless the
+ * Representation is functionally identically to another
+ * Representation in the same Period. */
+ if (g_strcmp0 (dashstream->active_stream->cur_representation->id,
+ dashstream->last_representation_id)) {
+ GstCaps *caps;
+ stream->need_header = TRUE;
+
+ GST_INFO_OBJECT (dashdemux,
+ "Representation changed from %s to %s - updating to bitrate %d",
+ GST_STR_NULL (dashstream->last_representation_id),
+ GST_STR_NULL (dashstream->active_stream->cur_representation->id),
+ dashstream->active_stream->cur_representation->bandwidth);
+
+ caps =
+ gst_dash_demux_get_input_caps (dashdemux,
+ dashstream->active_stream);
+ gst_adaptive_demux_stream_set_caps (stream, caps);
+
+ /* Update the stored last representation id */
+ g_free (dashstream->last_representation_id);
+ dashstream->last_representation_id =
+ g_strdup (dashstream->active_stream->cur_representation->id);
+ }
+ } else {
+ g_free (dashstream->last_representation_id);
+ dashstream->last_representation_id = NULL;
+ }
+ }
+