-
Notifications
You must be signed in to change notification settings - Fork 6k
[darwin] Update pixel format handling in FlutterTexture #52326
Conversation
CVPixelBuffers from the application can have arbitrary pixel formats. However, current implementation doesn't support all pixel formats. To address this, add a comment to the FlutterTexture class to clarify which pixel formats are supported. Also, reject unsupported pixel formats so that the application can handle them properly. Fixes #147242.
@@ -133,8 +133,11 @@ - (void)onTextureUnregistered { | |||
if (_pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange || | |||
_pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) { | |||
image = [self wrapNV12ExternalPixelBuffer:pixelBuffer context:context]; | |||
} else { | |||
} else if (_pixelFormat == kCVPixelFormatType_32BGRA) { | |||
image = [self wrapRGBAExternalPixelBuffer:pixelBuffer context:context]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is incorrectly named. Perhaps rename to wrapBGRAExternalPixelBuffer:context:
too? Internally, it does assume BGRA as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Note that [FlutterDarwinExternalTextureSkImageWrapper: wrapRGBATexture:grContext:width:height:]
also has RGBA in its name. I'm not sure renaming all of them to use BGRA is a good idea, but I'm open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If its not already a public method and the name is more fitting, go for it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was considering renaming the wrapRGBATexture
method, but I think it is better to keep the method name as it is.
We have kYUVA
and kRGBA
as the two possible values for FlutterMetalExternalTexturePixelFormat
, and the function I mentioned above is used along with the enum, FlutterMetalExternalTexturePixelFormat
. So it sounds like renaming would be more confusing.
It was requested to rename during the review, so I did it.
Fell free to merge this PR. Thanks for reviewing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…147336) flutter/engine@b5d5832...b30c0a7 2024-04-24 [email protected] Remove UIAccessibilityTraitKeyboardKey to fix touch typing (flutter/engine#52333) 2024-04-24 [email protected] [Impeller] Remove libtess2 from libflutter. (flutter/engine#52357) 2024-04-24 [email protected] Roll Skia from 510b6766d907 to afcc1db27593 (2 revisions) (flutter/engine#52367) 2024-04-24 [email protected] [web:tests] switch to new HTML DOM matcher (flutter/engine#52354) 2024-04-24 [email protected] [Impeller] use spec constant for gaussian shader, rename, and reuse vertex sources. (flutter/engine#52361) 2024-04-24 [email protected] [Impeller] delete points compute shader. (flutter/engine#52346) 2024-04-24 [email protected] [darwin] Update pixel format handling in FlutterTexture (flutter/engine#52326) 2024-04-24 [email protected] [Impeller] make drawAtlas always use porterduff or vertices_uber shader (flutter/engine#52348) 2024-04-24 [email protected] Migrate ios_surface files to ARC (flutter/engine#52139) 2024-04-24 [email protected] Roll Dart SDK from f470eaaf6e6d to 38c43a01a51e (1 revision) (flutter/engine#52365) 2024-04-24 [email protected] Roll Skia from b5dd23bd29df to 510b6766d907 (16 revisions) (flutter/engine#52364) 2024-04-24 [email protected] Fix some warnings reported by recent versions of clang-tidy (flutter/engine#52349) 2024-04-24 [email protected] Roll Skia from e15464e6e982 to b5dd23bd29df (1 revision) (flutter/engine#52353) 2024-04-24 [email protected] Roll Dart SDK from 5227dc5103f6 to f470eaaf6e6d (1 revision) (flutter/engine#52359) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
CVPixelBuffers from the application can have arbitrary pixel formats. However, current implementation doesn't support all pixel formats. To address this, add a comment to the FlutterTexture class to clarify which pixel formats are supported. Also, reject unsupported pixel formats so that the application can handle them properly.
Fixes #147242.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.