[FFmpeg-devel] [PATCH 3/3] libavcodec/v4l2_m2m_dec: set default time base

wm4 nfxjfg at googlemail.com
Tue Jan 9 01:45:40 EET 2018


On Mon,  8 Jan 2018 15:27:39 -0800
Lukas Rusak <lorusak at gmail.com> wrote:

> This default time base should be set in order for ffmpeg to rescale the timebase in v4l2_get_pts and v4l2_set_pts
> 
> ---
>  libavcodec/v4l2_m2m_dec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
> index 8308613978..4de091a011 100644
> --- a/libavcodec/v4l2_m2m_dec.c
> +++ b/libavcodec/v4l2_m2m_dec.c
> @@ -177,6 +177,8 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
>      capture->av_codec_id = AV_CODEC_ID_RAWVIDEO;
>      capture->av_pix_fmt = avctx->pix_fmt;
>  
> +    avctx->time_base = AV_TIME_BASE_Q;
> +
>      ret = ff_v4l2_m2m_codec_init(avctx);
>      if (ret) {
>          av_log(avctx, AV_LOG_ERROR, "can't configure decoder\n");

Decoders in FFmpeg don't really have a concept of a timebase. If they
do, they should not use avctx->time_base, but avctx->pkt_timebase.

(I don't think avctx->pkt_timebase even needs to be set - API users
normally expect that the decoder simply passes through timestamps,
regardless of timebase. But if pkt_timebase is set, it should be the
same timebase that AVPacket uses, and the output AVFrames must use the
same timebase.

avctx->time_base doesn't really mean anything for decoding. There is an
obscure "other" use of it that has been deprecated, and the replacement
has the same obscure use (see doxygen).


More information about the ffmpeg-devel mailing list