diff options
-rw-r--r-- | libavcodec/utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index fadfb0c0aa..707ecb5fef 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -714,6 +714,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD } avctx->frame_number = 0; + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && + (!avctx->time_base.num || !avctx->time_base.den)) { + avctx->time_base.num = 1; + avctx->time_base.den = avctx->sample_rate; + } + if (HAVE_THREADS && !avctx->thread_opaque) { ret = ff_thread_init(avctx); if (ret < 0) { |