Commit 7eb6eb03 authored by Stefano Sabatini's avatar Stefano Sabatini

lavc/mpegvideo_enc: simplify timestamp checks in load_input_picture()

Also improve error feedback while at it.
parent c4db4b17
...@@ -956,18 +956,17 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) ...@@ -956,18 +956,17 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
if (pts != AV_NOPTS_VALUE) { if (pts != AV_NOPTS_VALUE) {
if (s->user_specified_pts != AV_NOPTS_VALUE) { if (s->user_specified_pts != AV_NOPTS_VALUE) {
int64_t time = pts;
int64_t last = s->user_specified_pts; int64_t last = s->user_specified_pts;
if (time <= last) { if (pts <= last) {
av_log(s->avctx, AV_LOG_ERROR, av_log(s->avctx, AV_LOG_ERROR,
"Error, Invalid timestamp=%"PRId64", " "Invalid pts (%"PRId64") <= last (%"PRId64")\n",
"last=%"PRId64"\n", pts, s->user_specified_pts); pts, last);
return -1; return AVERROR(EINVAL);
} }
if (!s->low_delay && display_picture_number == 1) if (!s->low_delay && display_picture_number == 1)
s->dts_delta = time - last; s->dts_delta = pts - last;
} }
s->user_specified_pts = pts; s->user_specified_pts = pts;
} else { } else {
......
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