sdp相关特性暴露成常量

This commit is contained in:
xia-chu 2021-04-30 15:15:35 +08:00
parent dc2c882994
commit c77c4cfd4d
3 changed files with 31 additions and 19 deletions

View File

@ -1250,28 +1250,28 @@ bool RtcSession::supportRtcpFb(const string &name, TrackType type) const {
return ref.find(name) != ref.end();
}
static string const kTWCCRtcpFb = "transport-cc";
static string const kTWCCExtMap = "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01";
static string const kRembRtcpFb = "goog-remb";
static string const kRembExtMap = "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
string const SdpConst::kTWCCRtcpFb = "transport-cc";
string const SdpConst::kTWCCExtMap = "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01";
string const SdpConst::kRembRtcpFb = "goog-remb";
string const SdpConst::kRembExtMap = "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
void RtcConfigure::RtcTrackConfigure::enableTWCC(bool enable){
if (!enable) {
rtcp_fb.erase(kTWCCRtcpFb);
extmap.erase(kTWCCExtMap);
rtcp_fb.erase(SdpConst::kTWCCRtcpFb);
extmap.erase(SdpConst::kTWCCExtMap);
} else {
rtcp_fb.emplace(kTWCCRtcpFb);
extmap.emplace(kTWCCExtMap);
rtcp_fb.emplace(SdpConst::kTWCCRtcpFb);
extmap.emplace(SdpConst::kTWCCExtMap);
}
}
void RtcConfigure::RtcTrackConfigure::enableREMB(bool enable){
if (!enable) {
rtcp_fb.erase(kRembRtcpFb);
extmap.erase(kRembExtMap);
rtcp_fb.erase(SdpConst::kRembRtcpFb);
extmap.erase(SdpConst::kRembExtMap);
} else {
rtcp_fb.emplace(kRembRtcpFb);
extmap.emplace(kRembExtMap);
rtcp_fb.emplace(SdpConst::kRembRtcpFb);
extmap.emplace(SdpConst::kRembExtMap);
}
}
@ -1290,10 +1290,10 @@ void RtcConfigure::RtcTrackConfigure::setDefaultSetting(TrackType type){
case TrackAudio: {
//此处调整偏好的编码格式优先级
preferred_codec = {CodecAAC, CodecG711U, CodecG711A, CodecOpus};
rtcp_fb = {kTWCCRtcpFb, kRembRtcpFb};
rtcp_fb = {SdpConst::kTWCCRtcpFb, SdpConst::kRembRtcpFb};
extmap = {
kTWCCExtMap,
kRembExtMap,
SdpConst::kTWCCExtMap,
SdpConst::kRembExtMap,
"urn:ietf:params:rtp-hdrext:ssrc-audio-level",
"urn:ietf:params:rtp-hdrext:sdes:mid",
"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id",
@ -1304,10 +1304,10 @@ void RtcConfigure::RtcTrackConfigure::setDefaultSetting(TrackType type){
case TrackVideo: {
//此处调整偏好的编码格式优先级
preferred_codec = {CodecH264, CodecH265};
rtcp_fb = {kTWCCRtcpFb, kRembRtcpFb, "nack", "ccm fir", "nack pli"};
rtcp_fb = {SdpConst::kTWCCRtcpFb, SdpConst::kRembRtcpFb, "nack", "ccm fir", "nack pli"};
extmap = {
kTWCCExtMap,
kRembExtMap,
SdpConst::kTWCCExtMap,
SdpConst::kRembExtMap,
"urn:ietf:params:rtp-hdrext:toffset",
"urn:3gpp:video-orientation",
"http://www.webrtc.org/experiments/rtp-hdrext/playout-delay",

View File

@ -730,5 +730,17 @@ private:
RtcCodecPlan::Ptr _rtsp_audio_plan;
};
class SdpConst {
public:
static string const kTWCCRtcpFb;
static string const kTWCCExtMap;
static string const kRembRtcpFb;
static string const kRembExtMap;
private:
SdpConst() = delete;
~SdpConst() = delete;
};
#endif //ZLMEDIAKIT_SDP_H

View File

@ -623,7 +623,7 @@ void WebRtcTransportImp::onSortedRtp(const RtpPayloadInfo &info, RtpPacket::Ptr
//开启remb则发送remb包调节比特率
GET_CONFIG(size_t, remb_bit_rate, RTC::kRembBitRate);
if (remb_bit_rate) {
if (remb_bit_rate && getSdp(SdpType::answer).supportRtcpFb(SdpConst::kRembRtcpFb)) {
sendRtcpRemb(_recv_video_ssrc, remb_bit_rate);
}
}