[vlc-devel] [PATCH] demux: adaptive: fix misordered output

Zhao Zhili quinkblack at foxmail.com
Fri Nov 24 18:35:06 CET 2017


From: Zhao Zhili <wantlamy at gmail.com>

For packets like this:
A1, A2, B1, B2, A3...
which B1 has invalid timestamp and B2 has timestamp < barrier, B2 will
output but B1 is not, so misordered. A packet with invalid timestamp
should not output only if a packet with the same ES id has showed before
and timestamp larget than the barrier.
---
 modules/demux/adaptive/plumbing/CommandsQueue.cpp | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.cpp b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
index 0cbff82..850c94b 100644
--- a/modules/demux/adaptive/plumbing/CommandsQueue.cpp
+++ b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
@@ -280,7 +280,7 @@ const CommandsFactory * CommandsQueue::factory() const
 mtime_t CommandsQueue::Process( es_out_t *out, mtime_t barrier )
 {
     mtime_t lastdts = barrier;
-    std::set<const void *> allowinvalid;
+    std::set<const void *> disabled_esids;
     bool b_datasent = false;
 
     /* We need to filter the current commands list
@@ -324,22 +324,18 @@ mtime_t CommandsQueue::Process( es_out_t *out, mtime_t barrier )
             {
                 /* ensure no more non dated for that ES is sent
                  * since we're sure that data is above barrier */
-                allowinvalid.erase( id );
+                disabled_esids.insert( id );
                 commands.push_back( command );
             }
             else if( command->getTime() == VLC_TS_INVALID )
             {
-                /* Did we sent data already for that ES ? */
-                if( allowinvalid.find( id ) != allowinvalid.end() ||
-                   /* but also include invalid ones at start (other we will never dequeue them) */
-                   (commands.empty() && output.empty()) )
+                if( disabled_esids.find( id ) == disabled_esids.end() )
                     output.push_back( command );
                 else
                     commands.push_back( command );
             }
             else /* Falls below barrier, send */
             {
-                allowinvalid.insert( id );
                 output.push_back( command );
             }
         }
-- 
2.7.4



More information about the vlc-devel mailing list