Fixes #6500

I checked the h263 specification and the current implementation is already 
quite thorough. False positives, like #6500, can happen by pure chance. To 
improve the situation it would be necessary to further parse and validate 
additional data from the h263 "picture" layer.
A possible alternative is to add some heuristic in relation with TR (time 
reference): in all h263 samples which I could find, the first TR is zero and 
successive ones differ from the previous (mod 0xFF) by a small value, typically 
1. The score could be lowered if this doesn't happen (e.g. the value is 214 in 
#6500).
For now, my proposal is something much simpler, which takes care of #6500 and 
possibly other "unlucky" cases: the score is reduced to 12 if only a single 
valid PSC is found. Note that the current implementation already 
unconditionally reduces the score to 25 if there are less than 4 valid PSCs.

Signed-off-by: Dario Andreani <darioan...@gmail.com>
---
 libavformat/h263dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/h263dec.c b/libavformat/h263dec.c
index 0736158bfe..ff2828ed83 100644
--- a/libavformat/h263dec.c
+++ b/libavformat/h263dec.c
@@ -71,7 +71,7 @@ static int h263_probe(const AVProbeData *p)
     if(valid_psc > 2*invalid_psc + 2*res_change + 3){
         return AVPROBE_SCORE_EXTENSION;
     }else if(valid_psc > 2*invalid_psc)
-        return AVPROBE_SCORE_EXTENSION / 2;
+        return valid_psc > 1 ? AVPROBE_SCORE_EXTENSION / 2 : 
AVPROBE_SCORE_EXTENSION / 4;
     return 0;
 }
 
-- 
2.28.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to