From 1cbfd156c21dd71c5802c3b57804b40060194865 Mon Sep 17 00:00:00 2001 From: Huachao Mao Date: Sat, 11 Dec 2021 00:54:59 +0800 Subject: [PATCH 1/3] RTC: Replace payload name AV1X with AV1 for WebRTC. (#2760) --- trunk/src/app/srs_app_rtc_conn.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 8804773e85..3d4288efa1 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -2902,7 +2902,7 @@ srs_error_t SrsRtcConnection::negotiate_publish_capability(SrsRtcUserConfig* ruc break; } } else if (remote_media_desc.is_video() && ruc->codec_ == "av1") { - std::vector payloads = remote_media_desc.find_media_with_encoding_name("AV1X"); + std::vector payloads = remote_media_desc.find_media_with_encoding_name("AV1"); if (payloads.empty()) { return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no found valid AV1 payload type"); } @@ -3213,13 +3213,13 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRtcUserConfig* ruc, s remote_payload = payloads.at(0); track_descs = source->get_track_desc("audio", "opus"); } else if (remote_media_desc.is_video() && ruc->codec_ == "av1") { - std::vector payloads = remote_media_desc.find_media_with_encoding_name("AV1X"); + std::vector payloads = remote_media_desc.find_media_with_encoding_name("AV1"); if (payloads.empty()) { return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no found valid AV1 payload type"); } remote_payload = payloads.at(0); - track_descs = source->get_track_desc("video", "AV1X"); + track_descs = source->get_track_desc("video", "AV1"); } else if (remote_media_desc.is_video()) { // TODO: check opus format specific param vector payloads = remote_media_desc.find_media_with_encoding_name("H264"); From 36f68fa214af41b34e5a65f8973cf4cb9c6d6539 Mon Sep 17 00:00:00 2001 From: Huachao Mao Date: Sat, 11 Dec 2021 22:50:50 +0800 Subject: [PATCH 2/3] Add compatibility check code for old versions of Chrome --- trunk/src/app/srs_app_rtc_conn.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 3d4288efa1..8d708b338b 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -2903,6 +2903,11 @@ srs_error_t SrsRtcConnection::negotiate_publish_capability(SrsRtcUserConfig* ruc } } else if (remote_media_desc.is_video() && ruc->codec_ == "av1") { std::vector payloads = remote_media_desc.find_media_with_encoding_name("AV1"); + if (payloads.empty()) { + // Be compatible with the Chrome M96, still check the AV1X encoding name + // @see https://bugs.chromium.org/p/webrtc/issues/detail?id=13166 + payloads = remote_media_desc.find_media_with_encoding_name("AV1X"); + } if (payloads.empty()) { return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no found valid AV1 payload type"); } @@ -3214,6 +3219,11 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRtcUserConfig* ruc, s track_descs = source->get_track_desc("audio", "opus"); } else if (remote_media_desc.is_video() && ruc->codec_ == "av1") { std::vector payloads = remote_media_desc.find_media_with_encoding_name("AV1"); + if (payloads.empty()) { + // Be compatible with the Chrome M96, still check the AV1X encoding name + // @see https://bugs.chromium.org/p/webrtc/issues/detail?id=13166 + payloads = remote_media_desc.find_media_with_encoding_name("AV1X"); + } if (payloads.empty()) { return srs_error_new(ERROR_RTC_SDP_EXCHANGE, "no found valid AV1 payload type"); } From 294ae619fad7d03e209db0e52fbc4bdfeb7f4a0a Mon Sep 17 00:00:00 2001 From: Huachao Mao Date: Mon, 20 Dec 2021 11:35:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96track?= =?UTF-8?q?=5Fdesc=E7=9A=84AV1X=E7=BC=96=E7=A0=81=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trunk/src/app/srs_app_rtc_conn.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 8d708b338b..5a4e32ab42 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -3230,6 +3230,11 @@ srs_error_t SrsRtcConnection::negotiate_play_capability(SrsRtcUserConfig* ruc, s remote_payload = payloads.at(0); track_descs = source->get_track_desc("video", "AV1"); + if (track_descs.empty()) { + // Be compatible with the Chrome M96, still check the AV1X encoding name + // @see https://bugs.chromium.org/p/webrtc/issues/detail?id=13166 + track_descs = source->get_track_desc("video", "AV1X"); + } } else if (remote_media_desc.is_video()) { // TODO: check opus format specific param vector payloads = remote_media_desc.find_media_with_encoding_name("H264");