mirror of https://github.com/mpv-player/mpv
vd_lavc, ad_lavc: set pkt_timebase, not time_base
These are different AVCodecContext fields. pkt_timebase is the correct one for identifying the unit of packet/frame timestamps when decoding, while time_base is for encoding. Some decoders also overwrite the time_base field with some unrelated codec metadata. pkt_timebase does not exist in Libav, so an #if is required.
This commit is contained in:
parent
bda614bfd8
commit
0110b738d5
|
@ -103,7 +103,10 @@ static int init(struct dec_audio *da, const char *decoder)
|
|||
lavc_context->refcounted_frames = 1;
|
||||
lavc_context->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
lavc_context->codec_id = lavc_codec->id;
|
||||
lavc_context->time_base = ctx->codec_timebase;
|
||||
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
lavc_context->pkt_timebase = ctx->codec_timebase;
|
||||
#endif
|
||||
|
||||
if (opts->downmix && mpopts->audio_output_channels.num_chmaps == 1) {
|
||||
lavc_context->request_channel_layout =
|
||||
|
|
|
@ -460,7 +460,10 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
|
|||
avctx->opaque = vd;
|
||||
avctx->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
avctx->codec_id = lavc_codec->id;
|
||||
avctx->time_base = ctx->codec_timebase;
|
||||
|
||||
#if LIBAVCODEC_VERSION_MICRO >= 100
|
||||
avctx->pkt_timebase = ctx->codec_timebase;
|
||||
#endif
|
||||
|
||||
avctx->refcounted_frames = 1;
|
||||
ctx->pic = av_frame_alloc();
|
||||
|
|
Loading…
Reference in New Issue