Commit 606f2513 by xiongziliang

修复音频相关的bug

parent ce04a727
...@@ -558,6 +558,10 @@ void SdpAttrRtpMap::parse(const string &str) { ...@@ -558,6 +558,10 @@ void SdpAttrRtpMap::parse(const string &str) {
if (sscanf(str.data(), "%" SCNu8 " %31[^/]/%" SCNd32, &pt, buf, &sample_rate) != 3) { if (sscanf(str.data(), "%" SCNu8 " %31[^/]/%" SCNd32, &pt, buf, &sample_rate) != 3) {
SDP_THROW(); SDP_THROW();
} }
if (getTrackType(getCodecId(buf)) == TrackAudio) {
//未指定通道数时,且为音频时,那么通道数默认为1
channel = 1;
}
} }
codec = buf; codec = buf;
} }
...@@ -890,7 +894,7 @@ void RtcSession::loadFrom(const string &str, bool check) { ...@@ -890,7 +894,7 @@ void RtcSession::loadFrom(const string &str, bool check) {
auto rtpmap_it = rtpmap_map.find(pt); auto rtpmap_it = rtpmap_map.find(pt);
if (rtpmap_it == rtpmap_map.end()) { if (rtpmap_it == rtpmap_map.end()) {
plan.pt = pt; plan.pt = pt;
plan.codec = RtpPayload::getCodecId(pt); plan.codec = RtpPayload::getName(pt);
plan.sample_rate = RtpPayload::getClockRate(pt); plan.sample_rate = RtpPayload::getClockRate(pt);
plan.channel = RtpPayload::getAudioChannel(pt); plan.channel = RtpPayload::getAudioChannel(pt);
} else { } else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论