Commit e01b19de authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/mpegts: Fix probing of mpegts with invalid ASC

Fixes Ticket5566
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent a2e6c785
...@@ -542,8 +542,10 @@ static int analyze(const uint8_t *buf, int size, int packet_size, ...@@ -542,8 +542,10 @@ static int analyze(const uint8_t *buf, int size, int packet_size,
memset(stat, 0, packet_size * sizeof(*stat)); memset(stat, 0, packet_size * sizeof(*stat));
for (i = 0; i < size - 3; i++) { for (i = 0; i < size - 3; i++) {
if (buf[i] == 0x47 && if (buf[i] == 0x47) {
(!probe || (buf[i + 3] & 0x30))) { int pid = AV_RB16(buf+1) & 0x1FFF;
int asc = buf[i + 3] & 0x30;
if (!probe || pid == 0x1FFF || asc) {
int x = i % packet_size; int x = i % packet_size;
stat[x]++; stat[x]++;
stat_all++; stat_all++;
...@@ -552,6 +554,7 @@ static int analyze(const uint8_t *buf, int size, int packet_size, ...@@ -552,6 +554,7 @@ static int analyze(const uint8_t *buf, int size, int packet_size,
} }
} }
} }
}
return best_score - FFMAX(stat_all - 10*best_score, 0)/10; return best_score - FFMAX(stat_all - 10*best_score, 0)/10;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment