[vlc-commits] demux: adaptative: fix unsupported format regression

Francois Cartegnie git at videolan.org
Thu Dec 31 22:51:56 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 31 22:48:43 2015 +0100| [7b5bff3d15f887002866729db094a289056fae55] | committer: Francois Cartegnie

demux: adaptative: fix unsupported format regression

Due to hls we we waiting for demuxer to start, which would
load the demuxer source (sub playlist then) and from that
file we would have the format and change the demux if
required.

The problem is that any unsupported format (like split subtitles)
is now being to be demuxed and gets probed and demuxed.

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

 modules/demux/adaptative/SegmentTracker.cpp |   10 ++++++++++
 modules/demux/adaptative/SegmentTracker.hpp |    1 +
 modules/demux/adaptative/StreamFormat.cpp   |    2 ++
 modules/demux/adaptative/Streams.cpp        |   24 ++++++++++++++----------
 4 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/modules/demux/adaptative/SegmentTracker.cpp b/modules/demux/adaptative/SegmentTracker.cpp
index 5cc68d5..a36eaf7 100644
--- a/modules/demux/adaptative/SegmentTracker.cpp
+++ b/modules/demux/adaptative/SegmentTracker.cpp
@@ -72,6 +72,16 @@ void SegmentTracker::setAdaptationLogic(AbstractAdaptationLogic *logic_)
     registerListener(logic);
 }
 
+StreamFormat SegmentTracker::initialFormat() const
+{
+    BaseRepresentation *rep = curRepresentation;
+    if(!rep)
+        rep = logic->getNextRepresentation(adaptationSet, NULL);
+    if(rep)
+        return rep->getStreamFormat();
+    return StreamFormat();
+}
+
 bool SegmentTracker::segmentsListReady() const
 {
     BaseRepresentation *rep = curRepresentation;
diff --git a/modules/demux/adaptative/SegmentTracker.hpp b/modules/demux/adaptative/SegmentTracker.hpp
index 539f6ef..b80a642 100644
--- a/modules/demux/adaptative/SegmentTracker.hpp
+++ b/modules/demux/adaptative/SegmentTracker.hpp
@@ -95,6 +95,7 @@ namespace adaptative
             ~SegmentTracker();
 
             void setAdaptationLogic(AbstractAdaptationLogic *);
+            StreamFormat initialFormat() const;
             bool segmentsListReady() const;
             void reset();
             SegmentChunk* getNextChunk(bool, HTTPConnectionManager *);
diff --git a/modules/demux/adaptative/StreamFormat.cpp b/modules/demux/adaptative/StreamFormat.cpp
index 91b7e7e..3626969 100644
--- a/modules/demux/adaptative/StreamFormat.cpp
+++ b/modules/demux/adaptative/StreamFormat.cpp
@@ -40,6 +40,8 @@ std::string StreamFormat::str() const
             return "Timed Text";
         case PACKEDAAC:
             return "Packed AAC";
+        case UNSUPPORTED:
+            return "Unsupported";
         default:
         case UNKNOWN:
             return "Unknown";
diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index 5b9fcd6..31bfe6f 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -228,19 +228,23 @@ AbstractStream::status AbstractStream::demux(mtime_t nz_deadline, bool send)
         return AbstractStream::status_dis;
     }
 
-    if(!demuxer && !startDemux())
+    if(!demuxer)
     {
-        /* If demux fails because of probing failure / wrong format*/
-        if(discontinuity)
+        format = segmentTracker->initialFormat();
+        if(!startDemux())
         {
-            msg_Dbg( p_realdemux, "Flushing on format change" );
-            prepareFormatChange();
-            discontinuity = false;
-            flushing = true;
-            return AbstractStream::status_buffering;
+            /* If demux fails because of probing failure / wrong format*/
+            if(discontinuity)
+            {
+                msg_Dbg( p_realdemux, "Flushing on format change" );
+                prepareFormatChange();
+                discontinuity = false;
+                flushing = true;
+                return AbstractStream::status_buffering;
+            }
+            dead = true; /* Prevent further retries */
+            return AbstractStream::status_eof;
         }
-        dead = true; /* Prevent further retries */
-        return AbstractStream::status_eof;
     }
 
     if(nz_deadline + VLC_TS_0 > getBufferingLevel()) /* not already demuxed */



More information about the vlc-commits mailing list