-
-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve codecs priority #1144
Preserve codecs priority #1144
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -885,7 +885,9 @@ void Description::Application::parseSdpLine(string_view line) { | |
Description::Media::Media(const string &sdp) : Entry(get_first_line(sdp), "", Direction::Unknown) { | ||
string line; | ||
std::istringstream ss(sdp); | ||
std::getline(ss, line); // discard first line | ||
std::getline(ss, line); | ||
parseFirstLine(line); // save codecs order | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method parses the first line a second time, which is not ideal. |
||
|
||
while (ss) { | ||
std::getline(ss, line); | ||
trim_end(line); | ||
|
@@ -905,8 +907,9 @@ Description::Media::Media(const string &mline, string mid, Direction dir) | |
string Description::Media::description() const { | ||
std::ostringstream desc; | ||
desc << Entry::description(); | ||
for (auto it = mRtpMaps.begin(); it != mRtpMaps.end(); ++it) | ||
desc << ' ' << it->first; | ||
for(const string&codec : mCodecsOrder) { | ||
desc << ' ' << codec; | ||
} | ||
|
||
return desc.str(); | ||
} | ||
|
@@ -1051,6 +1054,17 @@ string Description::Media::generateSdpLines(string_view eol) const { | |
return sdp.str(); | ||
} | ||
|
||
void Description::Media::parseFirstLine(string line) { | ||
std::istringstream ss(line); | ||
string word; | ||
std::getline(ss, word, ' '); // audio | ||
std::getline(ss, word, ' '); // 9 | ||
std::getline(ss, word, ' '); // UDP/TLS/RTP/SAVPF | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic here is different from the one in |
||
while (std::getline(ss, word, ' ')) { | ||
mCodecsOrder.push_back(word); | ||
} | ||
} | ||
|
||
void Description::Media::parseSdpLine(string_view line) { | ||
if (match_prefix(line, "a=")) { | ||
string_view attr = line.substr(2); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should contain integers as they are payload types, and I would suggest renaming it to a more explicit
mOrderedPayloadTypes
: