-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
fix: unrecognized fmtp parameter caused crash #3162
fix: unrecognized fmtp parameter caused crash #3162
Conversation
trunk/src/app/srs_app_rtc_sdp.cpp
Outdated
@@ -59,6 +59,9 @@ srs_error_t srs_parse_h264_fmtp(const std::string& fmtp, H264SpecificParam& h264 | |||
std::vector<std::string> vec = split_str(fmtp, ";"); | |||
for (size_t i = 0; i < vec.size(); ++i) { | |||
std::vector<std::string> kv = split_str(vec[i], "="); | |||
if( kv.size() >= 2 && kv[0] == "sprop-parameter-sets") { // ignore sprop-parameter-sets |
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.
Why >=2
? Should be:
if (!kv.empty() && kv[0] == "sprop-parameter-sets") { // Ignore sprop-parameter-sets
??
trunk/src/app/srs_app_rtc_conn.cpp
Outdated
@@ -3171,6 +3175,11 @@ srs_error_t SrsRtcConnection::generate_publish_local_sdp(SrsRequest* req, SrsSdp | |||
} | |||
} | |||
|
|||
if (local_sdp.media_descs_.empty()){ | |||
srs_trace("empty media desc!"); |
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.
Please remove this line, because all information is in err, no need to logging here. The error message should be merged to err.
trunk/src/app/srs_app_rtc_conn.cpp
Outdated
@@ -3131,9 +3131,14 @@ srs_error_t SrsRtcConnection::generate_publish_local_sdp(SrsRequest* req, SrsSdp | |||
for (int i = 0; i < (int)stream_desc->video_track_descs_.size(); ++i) { | |||
SrsRtcTrackDescription* video_track = stream_desc->video_track_descs_.at(i); | |||
|
|||
SrsVideoPayload* payload = (SrsVideoPayload*)video_track->media_; | |||
if (payload == NULL){ |
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.
Should be replaced by:
if (!video_track->media_) break;
?
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.
Thanks for your review!
Is there any coding style guide? Someone likes me may need it.
0126030
to
34196ea
Compare
@@ -59,6 +59,9 @@ srs_error_t srs_parse_h264_fmtp(const std::string& fmtp, H264SpecificParam& h264 | |||
std::vector<std::string> vec = split_str(fmtp, ";"); | |||
for (size_t i = 0; i < vec.size(); ++i) { | |||
std::vector<std::string> kv = split_str(vec[i], "="); | |||
if( !kv.empty() && kv[0] == "sprop-parameter-sets") { // ignore sprop-parameter-sets |
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.
A better approach is to ignore the ones that are not recognized and only focus on checking if the required parameters meet the requirements.
However, I am still very grateful for the submitted PR. 👍
TRANS_BY_GPT3
Please describe the summary for this PR.
relative issue: #3093