changeset 6125:933bed6fbdc0 libavformat

matroskadec: add support for live broadcast containing unknown size clusters This interrupt parsing and goes one ebml level up when encountering a cluster start inside an unknown sized element which is not supposed to contain a cluster. fix issue1991
author aurel
date Fri, 11 Jun 2010 16:43:47 +0000
parents 778065ad3ac5
children 72bfd56f9a18
files matroskadec.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Fri Jun 11 16:36:51 2010 +0000
+++ b/matroskadec.c	Fri Jun 11 16:43:47 2010 +0000
@@ -518,7 +518,7 @@
 
     if (matroska->num_levels > 0) {
         MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
-        if (pos - level->start >= level->length) {
+        if (pos - level->start >= level->length || matroska->current_id) {
             matroska->num_levels--;
             return 1;
         }
@@ -716,6 +716,10 @@
     for (i=0; syntax[i].id; i++)
         if (id == syntax[i].id)
             break;
+    if (!syntax[i].id && id == MATROSKA_ID_CLUSTER &&
+        matroska->num_levels > 0 &&
+        matroska->levels[matroska->num_levels-1].length == 0xffffffffffffffff)
+        return 0;  // we reached the end of an unknown size cluster
     if (!syntax[i].id && id != EBML_ID_VOID && id != EBML_ID_CRC32)
         av_log(matroska->ctx, AV_LOG_INFO, "Unknown entry 0x%X\n", id);
     return ebml_parse_elem(matroska, &syntax[i], data);