Skip to content

Commit 3fba1c9

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
RTCRtpSender should allow maxFramerate of 0
https://bugs.webkit.org/show_bug.cgi?id=307227 rdar://169863687 Reviewed by Philippe Normand. This patch aligns WebKit with Gecko / Firefox, Blink / Chromium and Web Specification [1]. This patch updates our validation from <= to just < since we should just reject negative values. Previously, we were also rejecting when maxFramerate was '0', which is not aligned with below specification referenced: "Verify that the value of each maxFramerate member in sendEncodings that is defined is greater than 0.0." [1] https://w3c.github.io/webrtc-pc/#dfn-addtransceiver-sendencodings-validation-steps * Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp: (WebCore::validateSendEncodings): * LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpParameters-maxFramerate-expected.txt: Progression Canonical link: https://commits.webkit.org/307034@main
1 parent a1805f2 commit 3fba1c9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpParameters-maxFramerate-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PASS setParameters() with maxFramerate undefined->16 should succeed with RTCRtpT
1010
PASS setParameters() with maxFramerate undefined->16 should succeed without RTCRtpTransceiverInit
1111
FAIL setParameters() with maxFramerate 24->undefined should succeed with RTCRtpTransceiverInit assert_equals: expected (undefined) undefined but got (number) 24
1212
FAIL setParameters() with maxFramerate 24->undefined should succeed without RTCRtpTransceiverInit assert_equals: expected (undefined) undefined but got (number) 24
13-
FAIL setParameters() with maxFramerate 0->16 should succeed with RTCRtpTransceiverInit promise_test: Unhandled rejection with value: object "RangeError: maxFrameRate is below or equal 0"
13+
PASS setParameters() with maxFramerate 0->16 should succeed with RTCRtpTransceiverInit
1414
PASS setParameters() with maxFramerate 0->16 should succeed without RTCRtpTransceiverInit
1515
PASS setParameters() with maxFramerate 24->0 should succeed with RTCRtpTransceiverInit
1616
PASS setParameters() with maxFramerate 24->0 should succeed without RTCRtpTransceiverInit

Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (C) 2012 Google Inc. All rights reserved.
33
* Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
44
* Copyright (C) 2015, 2016 Ericsson AB. All rights reserved.
5-
* Copyright (C) 2017-2025 Apple Inc. All rights reserved.
5+
* Copyright (C) 2017-2026 Apple Inc. All rights reserved.
66
*
77
* Redistribution and use in source and binary forms, with or without
88
* modification, are permitted provided that the following conditions
@@ -210,8 +210,8 @@ static std::optional<Exception> validateSendEncodings(Vector<RTCRtpEncodingParam
210210
if (encoding.scaleResolutionDownBy && *encoding.scaleResolutionDownBy < 1)
211211
return Exception { ExceptionCode::RangeError, "scaleResolutionDownBy is below 1"_s };
212212

213-
if (encoding.maxFramerate && *encoding.maxFramerate <= 0)
214-
return Exception { ExceptionCode::RangeError, "maxFrameRate is below or equal 0"_s };
213+
if (encoding.maxFramerate && *encoding.maxFramerate < 0)
214+
return Exception { ExceptionCode::RangeError, "maxFrameRate is below 0"_s };
215215

216216
if (hasAnyScaleResolutionDownBy) {
217217
if (!encoding.scaleResolutionDownBy)

0 commit comments

Comments
 (0)