diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-06-27 13:05:41 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-06-27 17:46:52 +0200 |
commit | 7eb6eb03d83a4d6454ce1e20ec672dbf99f8f009 (patch) | |
tree | d4d873ac0afda30e1b6c825bc996e70425bb0b35 | |
parent | c4db4b17569fa4230f41fb758c147e50b3f1fa3f (diff) | |
download | ffmpeg-7eb6eb03d83a4d6454ce1e20ec672dbf99f8f009.tar.gz |
lavc/mpegvideo_enc: simplify timestamp checks in load_input_picture()
Also improve error feedback while at it.
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index de018e33ac..cce5991fe4 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -956,18 +956,17 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) if (pts != AV_NOPTS_VALUE) { if (s->user_specified_pts != AV_NOPTS_VALUE) { - int64_t time = pts; int64_t last = s->user_specified_pts; - if (time <= last) { + if (pts <= last) { av_log(s->avctx, AV_LOG_ERROR, - "Error, Invalid timestamp=%"PRId64", " - "last=%"PRId64"\n", pts, s->user_specified_pts); - return -1; + "Invalid pts (%"PRId64") <= last (%"PRId64")\n", + pts, last); + return AVERROR(EINVAL); } if (!s->low_delay && display_picture_number == 1) - s->dts_delta = time - last; + s->dts_delta = pts - last; } s->user_specified_pts = pts; } else { |