diff options
author | Rick Kern <kernrj@gmail.com> | 2016-04-27 10:53:09 -0400 |
---|---|---|
committer | wm4 <nfxjfg@googlemail.com> | 2016-05-04 18:40:40 +0200 |
commit | 2fbf39382dbf38e7cfdd2b106da66ca2f5af307d (patch) | |
tree | 0f7804cf709c6d0adcda7f5844f20ebf4be6c907 /libavcodec/videotoolboxenc.c | |
parent | abe05892bee9de9c657f91beef6ce1fa31bdf577 (diff) | |
download | ffmpeg-2fbf39382dbf38e7cfdd2b106da66ca2f5af307d.tar.gz |
lavc/videotoolboxenc: Fix DTS
Some devices output an invalid DTS when B-frames aren't used. Using PTS for
the DTS in this case.
Signed-off-by: Rick Kern <kernrj@gmail.com>
Diffstat (limited to 'libavcodec/videotoolboxenc.c')
-rw-r--r-- | libavcodec/videotoolboxenc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 25c9648bcb..72c7ba8994 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -1034,6 +1034,15 @@ static int vtenc_cm_to_avpacket( pts = CMSampleBufferGetPresentationTimeStamp(sample_buffer); dts = CMSampleBufferGetDecodeTimeStamp (sample_buffer); + if (CMTIME_IS_INVALID(dts)) { + if (!vtctx->has_b_frames) { + dts = pts; + } else { + av_log(avctx, AV_LOG_ERROR, "DTS is invalid.\n"); + return AVERROR_EXTERNAL; + } + } + dts_delta = vtctx->dts_delta >= 0 ? vtctx->dts_delta : 0; time_base_num = avctx->time_base.num; pkt->pts = pts.value / time_base_num; |