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

Steve Lhomme robux4 at videolabs.io
Mon Nov 27 17:31:55 CET 2017


---
 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() &&
-- 
2.14.2



More information about the vlc-devel mailing list