Refine: 优化webrtc sdp处理代码

This commit is contained in:
ziyue 2021-11-18 21:36:10 +08:00
parent daa06ffd4f
commit fb97c2139a
2 changed files with 6 additions and 11 deletions

View File

@ -1447,16 +1447,14 @@ void RtcConfigure::RtcTrackConfigure::setDefaultSetting(TrackType type){
} }
} }
void RtcConfigure::setDefaultSetting(string ice_ufrag, void RtcConfigure::setDefaultSetting(string ice_ufrag, string ice_pwd, RtpDirection direction,
string ice_pwd,
RtpDirection direction,
const SdpAttrFingerprint &fingerprint) { const SdpAttrFingerprint &fingerprint) {
video.setDefaultSetting(TrackVideo); video.setDefaultSetting(TrackVideo);
audio.setDefaultSetting(TrackAudio); audio.setDefaultSetting(TrackAudio);
application.setDefaultSetting(TrackApplication); application.setDefaultSetting(TrackApplication);
video.ice_ufrag = audio.ice_ufrag = application.ice_ufrag = ice_ufrag; video.ice_ufrag = audio.ice_ufrag = application.ice_ufrag = std::move(ice_ufrag);
video.ice_pwd = audio.ice_pwd = application.ice_pwd = ice_pwd; video.ice_pwd = audio.ice_pwd = application.ice_pwd = std::move(ice_pwd);
video.direction = audio.direction = application.direction = direction; video.direction = audio.direction = application.direction = direction;
video.fingerprint = audio.fingerprint = application.fingerprint = fingerprint; video.fingerprint = audio.fingerprint = application.fingerprint = fingerprint;
} }
@ -1579,7 +1577,7 @@ static RtpDirection matchDirection(RtpDirection offer_direction, RtpDirection su
} }
} }
void RtcConfigure::matchMedia(shared_ptr<RtcSession> &ret, TrackType type, const vector<RtcMedia> &medias, const RtcTrackConfigure &configure){ void RtcConfigure::matchMedia(const shared_ptr<RtcSession> &ret, TrackType type, const vector<RtcMedia> &medias, const RtcTrackConfigure &configure){
bool check_profile = true; bool check_profile = true;
bool check_codec = true; bool check_codec = true;

View File

@ -710,10 +710,7 @@ public:
RtcTrackConfigure audio; RtcTrackConfigure audio;
RtcTrackConfigure application; RtcTrackConfigure application;
void setDefaultSetting(string ice_ufrag, void setDefaultSetting(string ice_ufrag, string ice_pwd, RtpDirection direction, const SdpAttrFingerprint &fingerprint);
string ice_pwd,
RtpDirection direction,
const SdpAttrFingerprint &fingerprint);
void addCandidate(const SdpAttrCandidate &candidate, TrackType type = TrackInvalid); void addCandidate(const SdpAttrCandidate &candidate, TrackType type = TrackInvalid);
shared_ptr<RtcSession> createAnswer(const RtcSession &offer); shared_ptr<RtcSession> createAnswer(const RtcSession &offer);
@ -724,7 +721,7 @@ public:
void enableREMB(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(const shared_ptr<RtcSession> &ret, TrackType type, const vector<RtcMedia> &medias, const RtcTrackConfigure &configure);
bool onCheckCodecProfile(const RtcCodecPlan &plan, CodecId codec); bool onCheckCodecProfile(const RtcCodecPlan &plan, CodecId codec);
void onSelectPlan(RtcCodecPlan &plan, CodecId codec); void onSelectPlan(RtcCodecPlan &plan, CodecId codec);