支持生成 sdp 时指定端口 (#1161)

This commit is contained in:
Xiaofeng Wang 2021-10-15 14:10:04 +08:00 committed by GitHub
parent 2a2597a874
commit fe450ba2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,7 @@ string SdpTrack::getControlUrl(const string &base_url) const {
return base_url + "/" + _control; return base_url + "/" + _control;
} }
string SdpTrack::toString() const { string SdpTrack::toString(uint16_t port) const {
_StrPrinter _printer; _StrPrinter _printer;
switch (_type) { switch (_type) {
case TrackTitle: { case TrackTitle: {
@ -106,9 +106,9 @@ string SdpTrack::toString() const {
case TrackAudio: case TrackAudio:
case TrackVideo: { case TrackVideo: {
if (_type == TrackAudio) { if (_type == TrackAudio) {
_printer << "m=audio 0 RTP/AVP " << _pt << "\r\n"; _printer << "m=audio " << port << " RTP/AVP " << _pt << "\r\n";
} else { } else {
_printer << "m=video 0 RTP/AVP " << _pt << "\r\n"; _printer << "m=video " << port << " RTP/AVP " << _pt << "\r\n";
} }
if (!_b.empty()) { if (!_b.empty()) {
_printer << "b=" << _b << "\r\n"; _printer << "b=" << _b << "\r\n";

View File

@ -216,7 +216,7 @@ public:
map<char, string> _other; map<char, string> _other;
multimap<string, string> _attr; multimap<string, string> _attr;
string toString() const; string toString(uint16_t port = 0) const;
string getName() const; string getName() const;
string getControlUrl(const string &base_url) const; string getControlUrl(const string &base_url) const;