WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch for landing
bug-231353-20211013123839.patch (text/plain), 5.44 KB, created by
Cameron McCormack (:heycam)
on 2021-10-12 18:38:43 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Cameron McCormack (:heycam)
Created:
2021-10-12 18:38:43 PDT
Size:
5.44 KB
patch
obsolete
>Subversion Revision: 283950 >diff --git a/Source/ThirdParty/libwebrtc/ChangeLog b/Source/ThirdParty/libwebrtc/ChangeLog >index fe2fe64e15efbe8174aaa431a9042cfb936b3841..3dda871e333433a2eca1e99f5a2c1d65be455452 100644 >--- a/Source/ThirdParty/libwebrtc/ChangeLog >+++ b/Source/ThirdParty/libwebrtc/ChangeLog >@@ -1,3 +1,25 @@ >+2021-10-10 Cameron McCormack <heycam@apple.com> >+ >+ Override guessed color space for incoming H.264/265 streams >+ https://bugs.webkit.org/show_bug.cgi?id=231353 >+ <rdar://problem/83969311> >+ >+ Reviewed by Youenn Fablet. >+ >+ When the VTDecompressionSession decodes incoming H.264/H.265 samples, >+ it puts guessed color space attachments on the CVPixelBuffer, and the >+ guesses are based on video resolution. WebRTC streams however default >+ to being sRGB. So this patch overrides a guess with what we know the >+ stream will be. (Once we support different color spaces in WebRTC >+ video streams we'll need to adjust this.) >+ >+ * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm: >+ (overrideColorSpaceAttachmentsIfNeeded): >+ (decompressionOutputCallback): >+ * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH265.mm: >+ (overrideColorSpaceAttachmentsIfNeeded): >+ (h265DecompressionOutputCallback): >+ > 2021-10-06 Youenn Fablet <youenn@apple.com> > > ObjectiveC WebRTC frame buffers are autoreleased late, especially on Debug builds >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm >index c3f1b702f9d479d5acd894456512d836b2f6a48a..7e904196454e79a131d7982b508081e6eaf3742c 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm >@@ -41,6 +41,18 @@ @interface RTCVideoDecoderH264 () > - (void)setError:(OSStatus)error; > @end > >+static void overrideColorSpaceAttachmentsIfNeeded(CVImageBufferRef imageBuffer) { >+ auto guess = CVBufferGetAttachment(imageBuffer, (CFStringRef)@"ColorInfoGuessedBy", nullptr); >+ if (!guess || !CFEqual(guess, (CFStringRef)@"VideoToolbox")) >+ return; >+ >+ CVBufferRemoveAttachment(imageBuffer, kCVImageBufferCGColorSpaceKey); >+ CVBufferSetAttachment(imageBuffer, kCVImageBufferColorPrimariesKey, kCVImageBufferColorPrimaries_ITU_R_709_2, kCVAttachmentMode_ShouldPropagate); >+ CVBufferSetAttachment(imageBuffer, kCVImageBufferTransferFunctionKey, kCVImageBufferTransferFunction_sRGB, kCVAttachmentMode_ShouldPropagate); >+ CVBufferSetAttachment(imageBuffer, kCVImageBufferYCbCrMatrixKey, kCVImageBufferYCbCrMatrix_ITU_R_709_2, kCVAttachmentMode_ShouldPropagate); >+ CVBufferSetAttachment(imageBuffer, (CFStringRef)@"ColorInfoGuessedBy", (CFStringRef)@"RTCVideoDecoderH264", kCVAttachmentMode_ShouldPropagate); >+} >+ > // This is the callback function that VideoToolbox calls when decode is > // complete. > void decompressionOutputCallback(void *decoderRef, >@@ -57,6 +69,8 @@ void decompressionOutputCallback(void *decoderRef, > return; > } > >+ overrideColorSpaceAttachmentsIfNeeded(imageBuffer); >+ > std::unique_ptr<RTCFrameDecodeParams> decodeParams(reinterpret_cast<RTCFrameDecodeParams *>(params)); > // TODO(tkchin): Handle CVO properly. > RTCCVPixelBuffer *frameBuffer = [[RTCCVPixelBuffer alloc] initWithPixelBuffer:imageBuffer]; >diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH265.mm b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH265.mm >index 3131cb86fa8b829edbf44c95ecf910c6311fc369..85663da6aebe45e81c2dab78e237351e6d5c55b6 100644 >--- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH265.mm >+++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH265.mm >@@ -38,6 +38,18 @@ @interface RTCVideoDecoderH265 () > - (void)setError:(OSStatus)error; > @end > >+static void overrideColorSpaceAttachmentsIfNeeded(CVImageBufferRef imageBuffer) { >+ auto guess = CVBufferGetAttachment(imageBuffer, (CFStringRef)@"ColorInfoGuessedBy", nullptr); >+ if (!guess || !CFEqual(guess, (CFStringRef)@"VideoToolbox")) >+ return; >+ >+ CVBufferRemoveAttachment(imageBuffer, kCVImageBufferCGColorSpaceKey); >+ CVBufferSetAttachment(imageBuffer, kCVImageBufferColorPrimariesKey, kCVImageBufferColorPrimaries_ITU_R_709_2, kCVAttachmentMode_ShouldPropagate); >+ CVBufferSetAttachment(imageBuffer, kCVImageBufferTransferFunctionKey, kCVImageBufferTransferFunction_sRGB, kCVAttachmentMode_ShouldPropagate); >+ CVBufferSetAttachment(imageBuffer, kCVImageBufferYCbCrMatrixKey, kCVImageBufferYCbCrMatrix_ITU_R_709_2, kCVAttachmentMode_ShouldPropagate); >+ CVBufferSetAttachment(imageBuffer, (CFStringRef)@"ColorInfoGuessedBy", (CFStringRef)@"RTCVideoDecoderH265", kCVAttachmentMode_ShouldPropagate); >+} >+ > // This is the callback function that VideoToolbox calls when decode is > // complete. > void h265DecompressionOutputCallback(void* decoderRef, >@@ -54,6 +66,8 @@ void h265DecompressionOutputCallback(void* decoderRef, > return; > } > >+ overrideColorSpaceAttachmentsIfNeeded(imageBuffer); >+ > std::unique_ptr<RTCH265FrameDecodeParams> decodeParams(reinterpret_cast<RTCH265FrameDecodeParams*>(params)); > // TODO(tkchin): Handle CVO properly. > RTCCVPixelBuffer* frameBuffer =
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 231353
:
440479
|
440480
|
440481
|
440483
|
440539
| 441028