From 56e38f9a79ea0e2d7525d4b6689abddbebaa0516 Mon Sep 17 00:00:00 2001 From: chenhaibo Date: Wed, 30 Jun 2021 16:02:18 +0800 Subject: [PATCH] update channel_layout by channels, for ffmpeg transcode opus to aac success --- trunk/src/app/srs_app_rtc_codec.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trunk/src/app/srs_app_rtc_codec.cpp b/trunk/src/app/srs_app_rtc_codec.cpp index d385608466..f04757f85c 100644 --- a/trunk/src/app/srs_app_rtc_codec.cpp +++ b/trunk/src/app/srs_app_rtc_codec.cpp @@ -147,6 +147,8 @@ srs_error_t SrsAudioTranscoder::init_dec(SrsAudioCodecId src_codec) if (avcodec_open2(dec_, codec, NULL) < 0) { return srs_error_new(ERROR_RTC_RTP_MUXER, "Could not open codec"); } + + dec_->channel_layout = av_get_default_channel_layout(dec_->channels); dec_frame_ = av_frame_alloc(); if (!dec_frame_) {