完善remb相关控制代码

This commit is contained in:
xia-chu 2021-05-06 10:40:21 +08:00
parent 6292824e34
commit 521d9f906b
3 changed files with 31 additions and 1 deletions

View File

@ -1394,6 +1394,29 @@ void RtcConfigure::enableTWCC(bool enable, TrackType type){
} }
} }
void RtcConfigure::enableREMB(bool enable, TrackType type){
switch (type) {
case TrackAudio: {
audio.enableREMB(enable);
break;
}
case TrackVideo: {
video.enableREMB(enable);
break;
}
case TrackApplication: {
application.enableREMB(enable);
break;
}
default: {
audio.enableREMB(enable);
video.enableREMB(enable);
application.enableREMB(enable);
break;
}
}
}
shared_ptr<RtcSession> RtcConfigure::createAnswer(const RtcSession &offer){ shared_ptr<RtcSession> RtcConfigure::createAnswer(const RtcSession &offer){
shared_ptr<RtcSession> ret = std::make_shared<RtcSession>(); shared_ptr<RtcSession> ret = std::make_shared<RtcSession>();
ret->version = offer.version; ret->version = offer.version;

View File

@ -719,6 +719,7 @@ public:
void setPlayRtspInfo(const string &sdp); void setPlayRtspInfo(const string &sdp);
void enableTWCC(bool enable = true, TrackType type = TrackInvalid); void enableTWCC(bool enable = true, TrackType type = TrackInvalid);
void enableREMB(bool enable = true, TrackType type = TrackInvalid);
private: private:
void matchMedia(shared_ptr<RtcSession> &ret, TrackType type, const vector<RtcMedia> &medias, const RtcTrackConfigure &configure); void matchMedia(shared_ptr<RtcSession> &ret, TrackType type, const vector<RtcMedia> &medias, const RtcTrackConfigure &configure);

View File

@ -187,7 +187,13 @@ void WebRtcTransport::onCheckSdp(SdpType type, RtcSession &sdp){
void WebRtcTransport::onRtcConfigure(RtcConfigure &configure) const { void WebRtcTransport::onRtcConfigure(RtcConfigure &configure) const {
//开启remb后关闭twcc因为开启twcc后remb无效 //开启remb后关闭twcc因为开启twcc后remb无效
GET_CONFIG(size_t, remb_bit_rate, RTC::kRembBitRate); GET_CONFIG(size_t, remb_bit_rate, RTC::kRembBitRate);
configure.enableTWCC(!remb_bit_rate); if (remb_bit_rate) {
configure.enableREMB(true);
configure.enableTWCC(false);
} else {
configure.enableREMB(false);
configure.enableTWCC(true);
}
} }
std::string WebRtcTransport::getAnswerSdp(const string &offer){ std::string WebRtcTransport::getAnswerSdp(const string &offer){