Skip to content

Commit 34bbf22

Browse files
Ahmad-S792Ahmad Saleem
authored andcommitted
setCodecPreferences should accept codecs regardless of mimeType case
https://bugs.webkit.org/show_bug.cgi?id=307157 rdar://169789074 Reviewed by Youenn Fablet. This patch aligns WebKit with Gecko / Firefox. Use case-insensitive comparison when checking mimeType prefix in toRtpCodecCapability to accept codecs with any case variation (e.g., "video/VP8", "VIDEO/vp8", "Video/Vp8"). * Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp: (WebCore::toRtpCodecCapability): * LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences-expected.txt: Progressions Canonical link: https://commits.webkit.org/307062@main
1 parent 582cb03 commit 34bbf22

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ PASS setCodecPreferences() can remove rtx
2121
PASS setCodecPreferences() can remove red
2222
PASS setCodecPreferences() can remove ulpfec
2323
PASS setCodecPreferences() filters on receiver and prefers receiver order
24-
FAIL setCodecPreferences should accept audio codecs regardless of mimeType case promise_test: Unhandled rejection with value: object "InvalidModificationError: RTCRtpCodecCapability bad mimeType"
25-
FAIL setCodecPreferences should accept video codecs regardless of mimeType case promise_test: Unhandled rejection with value: object "InvalidModificationError: RTCRtpCodecCapability bad mimeType"
24+
PASS setCodecPreferences should accept audio codecs regardless of mimeType case
25+
PASS setCodecPreferences should accept video codecs regardless of mimeType case
2626

Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018 Apple Inc. All rights reserved.
2+
* Copyright (C) 2018-2026 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -88,9 +88,9 @@ bool LibWebRTCRtpTransceiverBackend::stopped() const
8888
static inline ExceptionOr<webrtc::RtpCodecCapability> toRtpCodecCapability(const RTCRtpCodecCapability& codec)
8989
{
9090
webrtc::RtpCodecCapability rtcCodec;
91-
if (codec.mimeType.startsWith("video/"_s))
91+
if (codec.mimeType.startsWithIgnoringASCIICase("video/"_s))
9292
rtcCodec.kind = webrtc::MediaType::VIDEO;
93-
else if (codec.mimeType.startsWith("audio/"_s))
93+
else if (codec.mimeType.startsWithIgnoringASCIICase("audio/"_s))
9494
rtcCodec.kind = webrtc::MediaType::AUDIO;
9595
else
9696
return Exception { ExceptionCode::InvalidModificationError, "RTCRtpCodecCapability bad mimeType"_s };

0 commit comments

Comments
 (0)