diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 94f8ce731..4706ad1ca 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2022-09-09, Fix [#3093](https://github.com/ossrs/srs/issues/3093): WebRTC: Ignore unknown fmtp for h.264. v4.0.263 * v4.0, 2022-09-06, Fix [#3170](https://github.com/ossrs/srs/issues/3170): WebRTC: Support WHIP(WebRTC-HTTP ingestion protocol). v4.0.262 * v4.0, 2022-09-03, Fix HTTP url parsing bug. v4.0.261 * v4.0, 2022-09-03, For [#3167](https://github.com/ossrs/srs/issues/3167): WebRTC: Play stucked when republish. v4.0.260 diff --git a/trunk/src/app/srs_app_rtc_sdp.cpp b/trunk/src/app/srs_app_rtc_sdp.cpp index fbaa70111..2b191a898 100644 --- a/trunk/src/app/srs_app_rtc_sdp.cpp +++ b/trunk/src/app/srs_app_rtc_sdp.cpp @@ -56,32 +56,39 @@ static void skip_first_spaces(std::string& str) srs_error_t srs_parse_h264_fmtp(const std::string& fmtp, H264SpecificParam& h264_param) { srs_error_t err = srs_success; - std::vector vec = split_str(fmtp, ";"); + + std::vector vec = srs_string_split(fmtp, ";"); for (size_t i = 0; i < vec.size(); ++i) { - std::vector kv = split_str(vec[i], "="); - if (kv.size() == 2) { - if (kv[0] == "profile-level-id") { - h264_param.profile_level_id = kv[1]; - } else if (kv[0] == "packetization-mode") { - // 6.3. Non-Interleaved Mode - // This mode is in use when the value of the OPTIONAL packetization-mode - // media type parameter is equal to 1. This mode SHOULD be supported. - // It is primarily intended for low-delay applications. Only single NAL - // unit packets, STAP-As, and FU-As MAY be used in this mode. STAP-Bs, - // MTAPs, and FU-Bs MUST NOT be used. The transmission order of NAL - // units MUST comply with the NAL unit decoding order. - // @see https://tools.ietf.org/html/rfc6184#section-6.3 - h264_param.packetization_mode = kv[1]; - } else if (kv[0] == "level-asymmetry-allowed") { - h264_param.level_asymmerty_allow = kv[1]; - } 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()); + std::vector kv = srs_string_split(vec[i], "="); + if (kv.size() != 2) continue; + + if (kv[0] == "profile-level-id") { + h264_param.profile_level_id = kv[1]; + } else if (kv[0] == "packetization-mode") { + // 6.3. Non-Interleaved Mode + // This mode is in use when the value of the OPTIONAL packetization-mode + // media type parameter is equal to 1. This mode SHOULD be supported. + // It is primarily intended for low-delay applications. Only single NAL + // unit packets, STAP-As, and FU-As MAY be used in this mode. STAP-Bs, + // MTAPs, and FU-Bs MUST NOT be used. The transmission order of NAL + // units MUST comply with the NAL unit decoding order. + // @see https://tools.ietf.org/html/rfc6184#section-6.3 + h264_param.packetization_mode = kv[1]; + } else if (kv[0] == "level-asymmetry-allowed") { + h264_param.level_asymmerty_allow = kv[1]; } } + if (h264_param.profile_level_id.empty()) { + return srs_error_new(ERROR_RTC_SDP_DECODE, "no h264 param: profile-level-id"); + } + if (h264_param.packetization_mode.empty()) { + return srs_error_new(ERROR_RTC_SDP_DECODE, "no h264 param: packetization-mode"); + } + if (h264_param.level_asymmerty_allow.empty()) { + return srs_error_new(ERROR_RTC_SDP_DECODE, "no h264 param: level-asymmetry-allowed"); + } + return err; } diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index a0c890d32..01b4f5d5e 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 262 +#define VERSION_REVISION 263 #endif