[vlc-commits] demux: adaptive: fix misordered output

Zhao Zhili git at videolan.org
Tue Nov 28 10:58:19 CET 2017


vlc | branch: master | Zhao Zhili <wantlamy at gmail.com> | Sat Nov 25 01:35:06 2017 +0800| [a8b9dc7f2ed16f7442a5ab2a155c0682fd0ebb78] | committer: Francois Cartegnie

demux: adaptive: fix misordered output

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.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

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

 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 0cbff82d29..850c94b60e 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 );
             }
         }



More information about the vlc-commits mailing list