DASH: unroll and clarify
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 24 Apr 2014 19:52:00 +0000 (22:52 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 24 Apr 2014 19:52:00 +0000 (22:52 +0300)
modules/stream_filter/dash/mpd/SegmentTimeline.cpp

index 0294fe2..d6dcc38 100644 (file)
@@ -56,17 +56,16 @@ void dash::mpd::SegmentTimeline::setTimescale(int timescale)
 
 void dash::mpd::SegmentTimeline::addElement(dash::mpd::SegmentTimeline::Element *e)
 {
-    int64_t         offset = 0;
-    for ( int i = 0; i <= e->r; ++i )
+    int64_t offset = 0;
+
+    for ( int i = 0; i < e->r; ++i )
     {
         this->elements.push_back( e );
-        if ( i < e->r )
-        {
-            e = new SegmentTimeline::Element( *e );
-            offset += e->d;
-            e->t += offset;
-        }
+        e = new SegmentTimeline::Element( *e );
+        offset += e->d;
+        e->t += offset;
     }
+    this->elements.push_back( e );
 }
 
 const SegmentTimeline::Element*    SegmentTimeline::getElement( unsigned int index ) const