mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Refine SDP, parse H264 param
This commit is contained in:
parent
314e3159f0
commit
7069233783
1 changed files with 27 additions and 24 deletions
|
@ -1194,13 +1194,19 @@ SrsMediaPayloadType SrsVideoPayload::generate_media_payload_type()
|
|||
|
||||
srs_error_t SrsVideoPayload::set_h264_param_desc(std::string fmtp)
|
||||
{
|
||||
// TODO: FIXME: Refine code.
|
||||
// for example: level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
|
||||
srs_error_t err = srs_success;
|
||||
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) {
|
||||
|
||||
// For example: level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
|
||||
std::vector<std::string> attributes = split_str(fmtp, ";");
|
||||
|
||||
for (size_t i = 0; i < attributes.size(); ++i) {
|
||||
std::string attribute = attributes.at(i);
|
||||
|
||||
std::vector<std::string> kv = split_str(attribute, "=");
|
||||
if (kv.size() != 2) {
|
||||
return srs_error_new(ERROR_RTC_SDP_DECODE, "invalid h264 param=%s", attribute.c_str());
|
||||
}
|
||||
|
||||
if (kv[0] == "profile-level-id") {
|
||||
h264_param_.profile_level_id = kv[1];
|
||||
} else if (kv[0] == "packetization-mode") {
|
||||
|
@ -1218,9 +1224,6 @@ srs_error_t SrsVideoPayload::set_h264_param_desc(std::string fmtp)
|
|||
} else {
|
||||
return srs_error_new(ERROR_RTC_SDP_DECODE, "invalid h264 param=%s", kv[0].c_str());
|
||||
}
|
||||
} else {
|
||||
return srs_error_new(ERROR_RTC_SDP_DECODE, "invalid h264 param=%s", vec[i].c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue