dashdemux: remove unreachable code
authorFlorin Apostol <florin.apostol@oregan.net>
Mon, 2 Nov 2015 11:17:29 +0000 (11:17 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Mon, 2 Nov 2015 11:37:19 +0000 (11:37 +0000)
The stream->cur_seg_template is set to the lowest available segment
template (representation or adaptation or period, in this order).
Because the template elements are inherited, the lowest template will
have all the elements the parents had, so there is no need to check the
parent for an element that is not found in the child (eg initialisation
or index).

https://bugzilla.gnome.org/show_bug.cgi?id=752714

ext/dash/gstmpdparser.c

index 7b5c876..783d777 100644 (file)
@@ -5290,22 +5290,12 @@ gst_mpd_client_get_next_header (GstMpdClient * client, gchar ** uri,
       *range_start = 0;
       *range_end = stream->cur_segment_base->indexRange->first_byte_pos - 1;
     }
-  } else if (stream->cur_seg_template) {
-    const gchar *initialization = NULL;
-    if (stream->cur_seg_template->initialization) {
-      initialization = stream->cur_seg_template->initialization;
-    } else if (stream->cur_adapt_set->SegmentTemplate
-        && stream->cur_adapt_set->SegmentTemplate->initialization) {
-      initialization = stream->cur_adapt_set->SegmentTemplate->initialization;
-    } else if (stream_period->period->SegmentTemplate
-        && stream_period->period->SegmentTemplate->initialization) {
-      initialization = stream_period->period->SegmentTemplate->initialization;
-    }
-    if (initialization) {
-      *uri = gst_mpdparser_build_URL_from_template (initialization,
-          stream->cur_representation->id, 0,
-          stream->cur_representation->bandwidth, 0);
-    }
+  } else if (stream->cur_seg_template
+      && stream->cur_seg_template->initialization) {
+    *uri =
+        gst_mpdparser_build_URL_from_template (stream->
+        cur_seg_template->initialization, stream->cur_representation->id, 0,
+        stream->cur_representation->bandwidth, 0);
   }
 
   return *uri == NULL ? FALSE : TRUE;
@@ -5336,21 +5326,11 @@ gst_mpd_client_get_next_header_index (GstMpdClient * client, gchar ** uri,
             stream->cur_segment_base->Initialization));
     *range_start = stream->cur_segment_base->indexRange->first_byte_pos;
     *range_end = stream->cur_segment_base->indexRange->last_byte_pos;
-  } else if (stream->cur_seg_template) {
-    const gchar *initialization = NULL;
-    if (stream->cur_seg_template->index) {
-      initialization = stream->cur_seg_template->index;
-    } else if (stream->cur_adapt_set->SegmentTemplate
-        && stream->cur_adapt_set->SegmentTemplate->index) {
-      initialization = stream->cur_adapt_set->SegmentTemplate->index;
-    } else if (stream_period->period->SegmentTemplate
-        && stream_period->period->SegmentTemplate->index) {
-      initialization = stream_period->period->SegmentTemplate->index;
-    }
-    if (initialization)
-      *uri = gst_mpdparser_build_URL_from_template (initialization,
-          stream->cur_representation->id, 0,
-          stream->cur_representation->bandwidth, 0);
+  } else if (stream->cur_seg_template && stream->cur_seg_template->index) {
+    *uri =
+        gst_mpdparser_build_URL_from_template (stream->cur_seg_template->index,
+        stream->cur_representation->id, 0,
+        stream->cur_representation->bandwidth, 0);
   }
 
   return *uri == NULL ? FALSE : TRUE;