Skip to content
Snippets Groups Projects
Commit 9d6711f2 authored by Adrien Béraud's avatar Adrien Béraud Committed by Adrien Béraud
Browse files

media encoder: use codec preference for input format

Change-Id: I61cb396daa39c0f1abf019c16e1601ce5976de45
parent f4561667
Branches
No related tags found
No related merge requests found
......@@ -636,7 +636,8 @@ MediaEncoder::prepareEncoderContext(const AVCodec* outputCodec, bool is_video)
// keyframe.
// encoderCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
} else {
encoderCtx->sample_fmt = AV_SAMPLE_FMT_S16;
JAMI_WARNING("Codec format: {} {} {} {}", encoderName, audioOpts_.format, audioOpts_.sampleRate, audioOpts_.nbChannels);
encoderCtx->sample_fmt = (AVSampleFormat)audioOpts_.format;
encoderCtx->sample_rate = std::max(8000, audioOpts_.sampleRate);
encoderCtx->time_base = AVRational {1, encoderCtx->sample_rate};
if (audioOpts_.nbChannels > 2 || audioOpts_.nbChannels < 1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment