[vlc-devel] [vlc-commits] demux: adaptive: continue non dated packets for the same ES (fix #19145)

Zhao Zhili quinkblack at foxmail.com
Fri Nov 24 19:10:18 CET 2017



于 2017年11月24日 GMT+08:00 下午9:46:32, Francois Cartegnie <git at videolan.org> 写到:
>vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov
>24 14:16:32 2017 +0100| [dde7a83b2defc859048b88a105eb2884828c7de2] |
>committer: Francois Cartegnie
>
>demux: adaptive: continue non dated packets for the same ES (fix
>#19145)
>
>Otherwise creates misordered output.
>
>>
>http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dde7a83b2defc859048b88a105eb2884828c7de2
>---
>
>modules/demux/adaptive/plumbing/CommandsQueue.cpp | 42
>++++++++++++++++++++---
> modules/demux/adaptive/plumbing/CommandsQueue.hpp |  1 +
> 2 files changed, 39 insertions(+), 4 deletions(-)
>
>diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.cpp
>b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
>index bd4959d28c..0cbff82d29 100644
>--- a/modules/demux/adaptive/plumbing/CommandsQueue.cpp
>+++ b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
>@@ -28,6 +28,7 @@
> #include <vlc_block.h>
> #include <vlc_meta.h>
> #include <algorithm>
>+#include <set>
> 
> using namespace adaptive;
> 
>@@ -96,6 +97,11 @@ mtime_t EsOutSendCommand::getTime() const
>         return AbstractCommand::getTime();
> }
> 
>+const void * EsOutSendCommand::esIdentifier() const
>+{
>+    return static_cast<const void *>(p_fakeid);
>+}
>+
> EsOutDelCommand::EsOutDelCommand( FakeESOutID *p_es ) :
>     AbstractFakeEsCommand( ES_OUT_PRIVATE_COMMAND_DEL, p_es )
> {
>@@ -274,6 +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;
>     bool b_datasent = false;
> 
>     /* We need to filter the current commands list
>@@ -306,10 +313,37 @@ mtime_t CommandsQueue::Process( es_out_t *out,
>mtime_t barrier )
>         in.pop_front();
>         b_datasent = true;
> 
>-        if( command->getType() == ES_OUT_PRIVATE_COMMAND_SEND &&
>command->getTime() > barrier )
>-            commands.push_back( command );
>-        else
>-            output.push_back( command );
>+        if( command->getType() == ES_OUT_PRIVATE_COMMAND_SEND )
>+        {
>+            EsOutSendCommand *sendcommand =
>dynamic_cast<EsOutSendCommand *>(command);
>+            /* We need a stream identifier to send NON DATED data
>following DATA for the same ES */
>+            const void *id = (sendcommand) ?
>sendcommand->esIdentifier() : 0;

If dynamic_cast failed, it should not execute the code below. If the command has the type of COMMAND_SEND, then the dynamic_cast should not fail.

>+
>+            /* Not for now */
>+            if( command->getTime() > barrier ) /* Not for now */
>+            {
>+                /* ensure no more non dated for that ES is sent
>+                 * since we're sure that data is above barrier */
>+                allowinvalid.erase( 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()) )
>+                    output.push_back( command );
>+                else
>+                    commands.push_back( command );
>+            }
>+            else /* Falls below barrier, send */
>+            {
>+                allowinvalid.insert( id );
>+                output.push_back( command );
>+            }
>+        }
>+        else output.push_back( command ); /* will discard below */
>     }
> 
>     /* push remaining ones if broke above */
>diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.hpp
>b/modules/demux/adaptive/plumbing/CommandsQueue.hpp
>index a81d92998d..b730340ce8 100644
>--- a/modules/demux/adaptive/plumbing/CommandsQueue.hpp
>+++ b/modules/demux/adaptive/plumbing/CommandsQueue.hpp
>@@ -59,6 +59,7 @@ namespace adaptive
>             virtual ~EsOutSendCommand();
>             virtual void Execute( es_out_t *out );
>             virtual mtime_t getTime() const;
>+            const void * esIdentifier() const;
> 
>         protected:
>             EsOutSendCommand( FakeESOutID *, block_t * );
>
>_______________________________________________
>vlc-commits mailing list
>vlc-commits at videolan.org
>https://mailman.videolan.org/listinfo/vlc-commits

-- 
使用 K-9 Mail 发送自我的Android设备。




More information about the vlc-devel mailing list