[vlc-commits] demux: adaptive: fix regression with unknown/probed formats

Francois Cartegnie git at videolan.org
Fri Feb 28 15:42:48 CET 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 17 17:38:34 2020 +0100| [527e69e2b8160adf78c3e727f26fa8cbc72ac8cf] | committer: Francois Cartegnie

demux: adaptive: fix regression with unknown/probed formats

For HLS, format is now probed in demux when unknown, but it
can still change before the demuxer starts due to getMimeType
ref #24237

(cherry picked from commit 4616f0780fa1f630b70fabd2dfc1190a4b415901)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=527e69e2b8160adf78c3e727f26fa8cbc72ac8cf
---

 modules/demux/adaptive/SegmentTracker.cpp | 7 +++++++
 modules/demux/adaptive/Streams.cpp        | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptive/SegmentTracker.cpp b/modules/demux/adaptive/SegmentTracker.cpp
index 23835117cb..5a3f6cee58 100644
--- a/modules/demux/adaptive/SegmentTracker.cpp
+++ b/modules/demux/adaptive/SegmentTracker.cpp
@@ -210,6 +210,13 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed,
             return NULL; /* Force current demux to end */
         }
     }
+    else if(format == StreamFormat(StreamFormat::UNKNOWN) && prevRep && prevRep != rep)
+    {
+        /* Handle the corner case when only the demuxer can know the format and
+         * demuxer starts after the format change (Probe != buffering) */
+        notify(SegmentTrackerEvent(&format)); /* Notify new demux format */
+        return NULL; /* Force current demux to end */
+    }
 
     if(format == StreamFormat(StreamFormat::UNSUPPORTED))
     {
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index fe36b8df6f..9323539f2c 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -616,7 +616,7 @@ void AbstractStream::trackerEvent(const SegmentTrackerEvent &event)
 
         case SegmentTrackerEvent::FORMATCHANGE:
             /* Check if our current demux is still valid */
-            if(*event.u.format.f != format)
+            if(*event.u.format.f != format || format == StreamFormat(StreamFormat::UNKNOWN))
             {
                 /* Format has changed between segments, we need to drain and change demux */
                 msg_Info(p_realdemux, "Changing stream format %s -> %s",



More information about the vlc-commits mailing list