[vlc-commits] demux:mkv: keep reading data in the parent even if current element has no size

Steve Lhomme git at videolan.org
Mon Nov 27 20:55:55 CET 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Mon Nov 27 17:31:55 2017 +0100| [109ff7be075bd511902c18fdcd0db9ca8317cecd] | committer: Jean-Baptiste Kempf

demux:mkv: keep reading data in the parent even if current element has no size

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/mkv/Ebml_parser.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp
index f503493213..3f9a3ae668 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -164,7 +164,20 @@ EbmlElement *EbmlParser::Get( int n_call )
     else if (!m_el[mi_level-1]->IsFiniteSize())
         i_max_read = UINT64_MAX;
     else if (!p_prev)
+    {
         i_max_read = m_el[mi_level-1]->GetSize();
+        if (i_max_read == 0)
+        {
+            /* check if the parent still has data to read */
+            if ( mi_level > 1 &&
+                 m_el[mi_level-1]->GetEndPosition() < m_el[mi_level-2]->GetEndPosition() )
+            {
+                uint64 top = m_el[mi_level-2]->GetEndPosition();
+                uint64 bom = m_el[mi_level-1]->GetEndPosition();
+                i_max_read = top - bom;
+            }
+        }
+    }
     else {
         size_t size_lvl = mi_level;
         while ( size_lvl && m_el[size_lvl-1]->IsFiniteSize() &&



More information about the vlc-commits mailing list