summaryrefslogtreecommitdiff
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-06-07 15:46:08 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-06-07 15:46:08 +0200
commite01b19deceaafa2b7a9d59717484d8831b00cd71 (patch)
tree22de1c09835a1020ecb58779d3e370c5850a3905 /libavformat/mpegts.c
parenta2e6c785cec33d15d1bfde375447b1915cb30ca9 (diff)
downloadffmpeg-e01b19deceaafa2b7a9d59717484d8831b00cd71.tar.gz
avformat/mpegts: Fix probing of mpegts with invalid ASC
Fixes Ticket5566 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index d38b8af1b7..7d78c41d3c 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -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];
+ }
}
}
}