diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-16 23:07:28 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-16 23:59:26 +0200 |
commit | 4f187f0af13bf4ff4d4b9c8081ce0ef73ad91345 (patch) | |
tree | df414c2c382d093230bef07bd232d10b17db6025 | |
parent | 10c2d22ba19565ef65f6fd9cf6c8a931339470d4 (diff) | |
download | ffmpeg-4f187f0af13bf4ff4d4b9c8081ce0ef73ad91345.tar.gz |
avformat/mpegts: Use differential score for analyze()
This avoids high scores in random data that has a high 0x47 frequency
Fixes Ticket3844
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 427bcdf035f5decca182651acfe067d685b3feb5)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/mpegts.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 71140888a5..93344d7736 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -506,6 +506,7 @@ static int analyze(const uint8_t *buf, int size, int packet_size, int *index) int stat[TS_MAX_PACKET_SIZE]; int i; int best_score = 0; + int best_score2 = 0; memset(stat, 0, packet_size * sizeof(*stat)); @@ -517,11 +518,13 @@ static int analyze(const uint8_t *buf, int size, int packet_size, int *index) best_score = stat[x]; if (index) *index = x; + } else if (stat[x] > best_score2) { + best_score2 = stat[x]; } } } - return best_score; + return best_score - best_score2; } /* autodetect fec presence. Must have at least 1024 bytes */ |