-
Notifications
You must be signed in to change notification settings - Fork 6k
Flutter External Texture Based On Share Texture Underlying Share Con… #11276
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
1 similar comment
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@googlebot |
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.
Added some comments. This really badly needs a test of some sort - and ideally a benchmark. You could look at the tests in testing/scenarios_app
and add some similar ones to what is there on the iOS side. The android side needs some work for testing unfortunately.
shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
Outdated
Show resolved
Hide resolved
@dnfield hello, we got an error when running format_and_dart_text: |
The license tool can't handle random temp files, You very likely just need to add the new files you created to the |
One other issue with this - it looks like @ lujunchen has not signed a CLA, but commits in here appear to have been authored by that user. |
YES, my mistake. |
934cd6e
to
a386a66
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
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've added a few topical comments around the code. There isn't a working example of FlutterShareTexture (test or otherwise) and there is no docstrings for it, so it's a bit hard to reason about. Could you please add a test or a dependent PR that uses your change?
Generally speaking, the problem you are trying to address is a good one and something we should address. It's going to take a bit more polish on the PR to get a better understanding if we are attacking it the correct way.
#include "FlutterMacros.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
FLUTTER_EXPORT | ||
@protocol FlutterShareTexture <NSObject> |
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.
Please add interface docstring.
#include "FlutterMacros.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
FLUTTER_EXPORT | ||
@protocol FlutterShareTexture <NSObject> | ||
/* | ||
*copy OpenGL Texture directly |
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.
Please fix docstring formatting and use complete English sentences.
|
||
namespace flutter { | ||
|
||
class IOSExternalTextureShareContext : public flutter::Texture { |
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.
Please add class docstring.
IOSExternalTextureShareContext::IOSExternalTextureShareContext( | ||
int64_t textureId, | ||
NSObject<FlutterShareTexture>* externalTexture) | ||
: Texture(textureId), external_texture_(externalTexture) { |
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.
Shouldn't this have a retain on the external_texture_?
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.
YES, their are other issues about the crash caused by external texture.
#10326
Just as metioned by @chinmaygarde , having a retain here is not thread safe.
So we recommend users avoiding to release the external_texture_ object too early.
textureInfo.fTarget = GL_TEXTURE_2D; | ||
|
||
GrBackendTexture backendTexture(bounds.width(), bounds.height(), GrMipMapped::kNo, textureInfo); | ||
printf("paint test back\n"); |
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.
Stray print statement.
|
||
EAGLSharegroup* PlatformViewIOS::GetGLShareGroup() { | ||
if (ios_surface_.get() == NULL) | ||
return NULL; |
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.
return nullptr;
Add brackets.
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.
Opening a new pr is fine
OK , i've created a new pr, #11819 .
@gaaclarke @dnfield @chinmaygarde @gw280
Yes, we are looking at the tests in testing/scenarios_app and trying to add some similar ones. |
I'm very sorry that I accidentally deleted the external_texture_new branch, and result in the PR closed. |
Opening a new pr is fine |
Currently, external textures are very differently on iOS (CoreVideo) and Android (GL_OES_EGL_image_external).
In China, Portrait beauty effects are basically a must-have for a camera tool. We process our video frame on the GPU to generate a texture to be rendered. If flutter needs to display this texture, it requires a GPU->CPU->GPU process, wasting performance.
So we need to process the CoreVideo pixel buffer using OpenGL and give Flutter that texture directly instead of the pixel buffer
So we added an interface to Get Flutter GLContext on our Flutter branch. Based on this modification, we implemented the Flutter plugins such as Album, Video Capture, Video Editor.
And those plugins has been used by hundreds of millions of users on the Xianyu APP to verify its effectiveness。
We hope we can merge this change back to the flutter master so that more develop can use our plugins to develop video App。