From 920f06a9961de53b9aa542d93366a8f47f87c63b Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Thu, 30 Apr 2020 13:35:38 +0800 Subject: [PATCH] =?UTF-8?q?AAC=20sdp=E6=B7=BB=E5=8A=A0=E9=80=9A=E9=81=93?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/AAC.cpp | 2 +- src/Extension/AAC.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Extension/AAC.cpp b/src/Extension/AAC.cpp index 686fdd57..282bd2f0 100644 --- a/src/Extension/AAC.cpp +++ b/src/Extension/AAC.cpp @@ -103,7 +103,7 @@ Sdp::Ptr AACTrack::getSdp() { WarnL << getCodecName() << " Track未准备好"; return nullptr; } - return std::make_shared(getAacCfg(),getAudioSampleRate()); + return std::make_shared(getAacCfg(),getAudioSampleRate(), getAudioChannel()); } }//namespace mediakit diff --git a/src/Extension/AAC.h b/src/Extension/AAC.h index faf69198..2a57d6d4 100644 --- a/src/Extension/AAC.h +++ b/src/Extension/AAC.h @@ -276,11 +276,12 @@ public: */ AACSdp(const string &aac_cfg, int sample_rate, + int channels, int playload_type = 98, int bitrate = 128) : Sdp(sample_rate,playload_type){ _printer << "m=audio 0 RTP/AVP " << playload_type << "\r\n"; _printer << "b=AS:" << bitrate << "\r\n"; - _printer << "a=rtpmap:" << playload_type << " MPEG4-GENERIC/" << sample_rate << "\r\n"; + _printer << "a=rtpmap:" << playload_type << " MPEG4-GENERIC/" << sample_rate << "/" << channels << "\r\n"; char configStr[32] = {0}; snprintf(configStr, sizeof(configStr), "%02X%02X", (uint8_t)aac_cfg[0], (uint8_t)aac_cfg[1]);