[FFmpeg-devel] [PATCH 3/3] avcodec/cuvid: set best_effort_timestamp instead of frame pts
Timo Rothenpieler
timo at rothenpieler.org
Mon Oct 3 00:08:53 EEST 2016
---
libavcodec/cuvid.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index e9a1dd7..5ceb94e 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -451,25 +451,25 @@ static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame)
frame->width = avctx->width;
frame->height = avctx->height;
if (avctx->pkt_timebase.num && avctx->pkt_timebase.den)
- frame->pts = av_rescale_q(parsed_frame.dispinfo.timestamp, (AVRational){1, 10000000}, avctx->pkt_timebase);
+ frame->pkt_pts = av_rescale_q(parsed_frame.dispinfo.timestamp, (AVRational){1, 10000000}, avctx->pkt_timebase);
else
- frame->pts = parsed_frame.dispinfo.timestamp;
+ frame->pkt_pts = parsed_frame.dispinfo.timestamp;
if (parsed_frame.second_field) {
if (ctx->prev_pts == INT64_MIN) {
- ctx->prev_pts = frame->pts;
- frame->pts += (avctx->pkt_timebase.den * avctx->framerate.den) / (avctx->pkt_timebase.num * avctx->framerate.num);
+ ctx->prev_pts = frame->pkt_pts;
+ frame->pkt_pts += (avctx->pkt_timebase.den * avctx->framerate.den) / (avctx->pkt_timebase.num * avctx->framerate.num);
} else {
- int pts_diff = (frame->pts - ctx->prev_pts) / 2;
- ctx->prev_pts = frame->pts;
- frame->pts += pts_diff;
+ int pts_diff = (frame->pkt_pts - ctx->prev_pts) / 2;
+ ctx->prev_pts = frame->pkt_pts;
+ frame->pkt_pts += pts_diff;
}
}
/* CUVIDs opaque reordering breaks the internal pkt logic.
* So set pkt_pts and clear all the other pkt_ fields.
*/
- frame->pkt_pts = frame->pts;
+ av_frame_set_best_effort_timestamp(frame, frame->pkt_pts);
av_frame_set_pkt_pos(frame, -1);
av_frame_set_pkt_duration(frame, 0);
av_frame_set_pkt_size(frame, -1);
--
2.10.0
More information about the ffmpeg-devel
mailing list