diff options
author | wm4 <wm4@nowhere> | 2016-11-09 17:51:19 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-11-09 17:51:19 +0100 |
commit | fc1017c33533d4d2e0b82cef6cbf45ca64122950 (patch) | |
tree | 821e840b40b68f6d3f1ee5780c57ccc634b738b5 | |
parent | 67467103e8c7a143c8eafda86d312dfa0c949266 (diff) |
dec_video: don't spam missing PTS warnings
Only print at most 2. Just because with some decoders, we will always
hit this code path, such as playing avi of vfw-muxed mkv on RPI.
-rw-r--r-- | video/decode/dec_video.c | 11 | ||||
-rw-r--r-- | video/decode/dec_video.h | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index ed7cd875ea..dea5b594c7 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -64,6 +64,7 @@ void video_reset(struct dec_video *d_video) d_video->decoded_pts = MP_NOPTS_VALUE; d_video->codec_pts = MP_NOPTS_VALUE; d_video->codec_dts = MP_NOPTS_VALUE; + d_video->has_broken_decoded_pts = 0; d_video->last_format = d_video->fixed_format = (struct mp_image_params){0}; d_video->dropped_frames = 0; d_video->current_state = DATA_AGAIN; @@ -317,8 +318,14 @@ static struct mp_image *decode_packet(struct dec_video *d_video, pts = dts; if (!opts->correct_pts || pts == MP_NOPTS_VALUE) { - if (opts->correct_pts && !d_video->header->missing_timestamps) - MP_WARN(d_video, "No video PTS! Making something up.\n"); + if (opts->correct_pts && !d_video->header->missing_timestamps) { + if (d_video->has_broken_decoded_pts <= 1) { + MP_WARN(d_video, "No video PTS! Making something up.\n"); + if (d_video->has_broken_decoded_pts == 1) + MP_WARN(d_video, "Ignoring further missing PTS warnings.\n"); + d_video->has_broken_decoded_pts++; + } + } double frame_time = 1.0f / (d_video->fps > 0 ? d_video->fps : 25); double base = d_video->first_packet_pdts; diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h index f7bff61c9f..1d2b3f087e 100644 --- a/video/decode/dec_video.h +++ b/video/decode/dec_video.h @@ -62,6 +62,8 @@ struct dec_video { // There was at least one packet with non-sense timestamps. int has_broken_packet_pts; // <0: uninitialized, 0: no problems, 1: broken + int has_broken_decoded_pts; + // Final PTS of previously decoded image double decoded_pts; |