AAC sdp添加通道数

This commit is contained in:
xiongziliang 2020-04-30 13:35:38 +08:00
parent 3ad1fe4924
commit 920f06a996
2 changed files with 3 additions and 2 deletions

View File

@ -103,7 +103,7 @@ Sdp::Ptr AACTrack::getSdp() {
WarnL << getCodecName() << " Track未准备好";
return nullptr;
}
return std::make_shared<AACSdp>(getAacCfg(),getAudioSampleRate());
return std::make_shared<AACSdp>(getAacCfg(),getAudioSampleRate(), getAudioChannel());
}
}//namespace mediakit

View File

@ -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]);