[vlc-commits] stream_filter: dash: fix iteration on different lists

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:45 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Nov 17 22:42:10 2014 +0100| [2da28c96ee34523425ec9b0e25d6ace25cbc6611] | committer: Francois Cartegnie

stream_filter: dash: fix iteration on different lists

List was not returned by reference

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2da28c96ee34523425ec9b0e25d6ace25cbc6611
---

 modules/stream_filter/dash/mpd/AdaptationSet.cpp   |    2 +-
 modules/stream_filter/dash/mpd/AdaptationSet.h     |    2 +-
 modules/stream_filter/dash/mpd/IsoffMainParser.cpp |   15 ++++++++++-----
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/AdaptationSet.cpp b/modules/stream_filter/dash/mpd/AdaptationSet.cpp
index 2967692..d48fcc5 100644
--- a/modules/stream_filter/dash/mpd/AdaptationSet.cpp
+++ b/modules/stream_filter/dash/mpd/AdaptationSet.cpp
@@ -58,7 +58,7 @@ void AdaptationSet::setSubsegmentAlignmentFlag(bool alignment)
     this->subsegmentAlignmentFlag = alignment;
 }
 
-std::vector<Representation*>    AdaptationSet::getRepresentations       ()
+std::vector<Representation*>&    AdaptationSet::getRepresentations       ()
 {
     return this->representations;
 }
diff --git a/modules/stream_filter/dash/mpd/AdaptationSet.h b/modules/stream_filter/dash/mpd/AdaptationSet.h
index 063d466..8b48a4b 100644
--- a/modules/stream_filter/dash/mpd/AdaptationSet.h
+++ b/modules/stream_filter/dash/mpd/AdaptationSet.h
@@ -46,7 +46,7 @@ namespace dash
 
                 bool                            getSubsegmentAlignmentFlag() const;
                 void                            setSubsegmentAlignmentFlag( bool alignment );
-                std::vector<Representation *>   getRepresentations      ();
+                std::vector<Representation *>&  getRepresentations      ();
                 const Representation*           getRepresentationById   ( const std::string &id ) const;
                 const SegmentInfoDefault*       getSegmentInfoDefault() const;
                 void                            setSegmentInfoDefault( const SegmentInfoDefault* seg );
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index 8329990..35faa4d 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -192,15 +192,20 @@ void    IsoffMainParser::print              ()
             {
                 msg_Dbg(p_stream, "  AdaptationSet");
                 std::vector<Representation *>::const_iterator k;
-                for(k = (*j)->getRepresentations().begin(); k != (*j)->getRepresentations().begin(); k++)
+                for(k = (*j)->getRepresentations().begin(); k != (*j)->getRepresentations().end(); k++)
                 {
                     msg_Dbg(p_stream, "   Representation");
                     msg_Dbg(p_stream, "    InitSeg url=%s", (*k)->getSegmentBase()->getInitSegment()->getSourceUrl().c_str());
-                    std::vector<Segment *>::const_iterator l;
-                    for(l = (*k)->getSegmentList()->getSegments().begin();
-                        l < (*k)->getSegmentList()->getSegments().end(); l++)
+
+                    const SegmentList *segmentList = (*k)->getSegmentList();
+                    if (segmentList)
                     {
-                        msg_Dbg(p_stream, "    Segment url=%s", (*l)->getSourceUrl().c_str());
+                        std::vector<Segment *>::const_iterator l;
+                        for(l = segmentList->getSegments().begin();
+                            l < segmentList->getSegments().end(); l++)
+                        {
+                            msg_Dbg(p_stream, "    Segment url=%s", (*l)->getSourceUrl().c_str());
+                        }
                     }
                 }
             }



More information about the vlc-commits mailing list