[vlc-commits] demux: adaptive: reorder initial pcr when needed

Francois Cartegnie git at videolan.org
Wed May 16 20:03:15 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 16 16:50:35 2018 +0200| [82722e2c90eb9e4cd5670e55f563103a47c9e6ae] | committer: Francois Cartegnie

demux: adaptive: reorder initial pcr when needed

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

 modules/demux/adaptive/plumbing/CommandsQueue.cpp | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.cpp b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
index 0a3ea44c19..ffe6c43a57 100644
--- a/modules/demux/adaptive/plumbing/CommandsQueue.cpp
+++ b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
@@ -229,6 +229,17 @@ EsOutMetaCommand * CommandsFactory::createEsOutMetaCommand( int group, const vlc
 /*
  * Commands Queue management
  */
+#if 0
+/* For queue printing/debugging */
+std::ostream& operator<<(std::ostream& ostr, const std::list<AbstractCommand *>& list)
+{
+    for (auto &i : list) {
+        ostr << "[" << i->getType() << "]" << (i->getTime() /CLOCK_FREQ) << " ";
+    }
+    return ostr;
+}
+#endif
+
 CommandsQueue::CommandsQueue( CommandsFactory *f )
 {
     bufferinglevel = VLC_TS_INVALID;
@@ -249,7 +260,16 @@ CommandsQueue::~CommandsQueue()
 
 static bool compareCommands( AbstractCommand *a, AbstractCommand *b )
 {
-    return (a->getTime() < b->getTime() && a->getTime() != VLC_TS_INVALID);
+    if(a->getTime() == b->getTime())
+    {
+        /* Reorder the initial clock PCR setting PCR0 DTS0 PCR0 DTS1 PCR1
+           so it appears after the block, avoiding it not being output */
+        if(a->getType() == ES_OUT_SET_GROUP_PCR &&
+           b->getType() == ES_OUT_PRIVATE_COMMAND_SEND)
+            return false;
+        return true;
+    }
+    else return (a->getTime() < b->getTime() && a->getTime() != VLC_TS_INVALID);
 }
 
 void CommandsQueue::Schedule( AbstractCommand *command )



More information about the vlc-commits mailing list