]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpegts: Fix probing of mpegts with invalid ASC
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 7 Jun 2016 13:46:08 +0000 (15:46 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 7 Jun 2016 13:46:08 +0000 (15:46 +0200)
Fixes Ticket5566

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mpegts.c

index d38b8af1b77875bca53e64ac77aaf7567d2b0b3b..7d78c41d3c56033c4bf3b2e9aa2cf7310b7aed69 100644 (file)
@@ -542,13 +542,16 @@ static int analyze(const uint8_t *buf, int size, int packet_size,
     memset(stat, 0, packet_size * sizeof(*stat));
 
     for (i = 0; i < size - 3; i++) {
-        if (buf[i] == 0x47 &&
-            (!probe || (buf[i + 3] & 0x30))) {
-            int x = i % packet_size;
-            stat[x]++;
-            stat_all++;
-            if (stat[x] > best_score) {
-                best_score = stat[x];
+        if (buf[i] == 0x47) {
+            int pid = AV_RB16(buf+1) & 0x1FFF;
+            int asc = buf[i + 3] & 0x30;
+            if (!probe || pid == 0x1FFF || asc) {
+                int x = i % packet_size;
+                stat[x]++;
+                stat_all++;
+                if (stat[x] > best_score) {
+                    best_score = stat[x];
+                }
             }
         }
     }