ffmpeg: Add sanity check on frame duplication
This prevents long loops and OOM in case of damaged timestamps in some cases Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
a54bc1ebb8
commit
df3a96c497
5
ffmpeg.c
5
ffmpeg.c
@ -1770,6 +1770,11 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n");
|
av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n");
|
||||||
return;
|
return;
|
||||||
} else if (nb_frames > 1) {
|
} else if (nb_frames > 1) {
|
||||||
|
if (nb_frames > dts_error_threshold * 30) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "%d frame duplication too large, skiping\n", nb_frames - 1);
|
||||||
|
nb_frames_drop++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
nb_frames_dup += nb_frames - 1;
|
nb_frames_dup += nb_frames - 1;
|
||||||
av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1);
|
av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user