-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add SurfaceProducer.onSurfaceCleanup, deprecate onSurfaceDestroyed.
#160937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Thanks. I'm glad to see this change. Although I'm confused as to why it happened this time. Did something else change since #152839 was closed that made it more necessary? |
Contributor
Author
|
Another user filed a bug report with more details, so I understand the issue being presented now. |
reidbaker
approved these changes
Jan 6, 2025
1 task
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 6, 2025
|
Failed to create CP due to merge conflicts. |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 7, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 7, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 7, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 7, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 7, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 7, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 7, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 7, 2025
…61252) Follow-up to #160937 (#160933). This more or less mirrors what we did already for `onSurfaceCreated` to match `onSurfaceAvailable`. With this approach, the master branch should immediately start seeing better behavior in terms of being able to use the `onSurfaceDestroyed` callback effectively (before the surface has been released). For example, for a plugin that already uses `onSurfaceDestroyed`, [i.e `camerax`](https://github.com/flutter/packages/blob/97ce56a68eea650dc784617b4eed7814cccedeb8/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java): ```java @OverRide public void onSurfaceDestroyed() { // Invalidate the SurfaceRequest so that CameraX knows to to make a new request // for a surface. request.invalidate(); } ``` ... the request is now invalidated _before_ the surface has been destroyed, which is what (I believe) we wanted? --- Folks that want to publish package updates that _definitely_ use the correct timing will have to wait for the next stable. /cc @hasali19 would be great to get your input here.
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 7, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 8, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 8, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 8, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 8, 2025
srujzs
pushed a commit
to srujzs/flutter
that referenced
this pull request
Jan 12, 2025
…utter#161252) Follow-up to flutter#160937 (flutter#160933). This more or less mirrors what we did already for `onSurfaceCreated` to match `onSurfaceAvailable`. With this approach, the master branch should immediately start seeing better behavior in terms of being able to use the `onSurfaceDestroyed` callback effectively (before the surface has been released). For example, for a plugin that already uses `onSurfaceDestroyed`, [i.e `camerax`](https://github.com/flutter/packages/blob/97ce56a68eea650dc784617b4eed7814cccedeb8/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java): ```java @OverRide public void onSurfaceDestroyed() { // Invalidate the SurfaceRequest so that CameraX knows to to make a new request // for a surface. request.invalidate(); } ``` ... the request is now invalidated _before_ the surface has been destroyed, which is what (I believe) we wanted? --- Folks that want to publish package updates that _definitely_ use the correct timing will have to wait for the next stable. /cc @hasali19 would be great to get your input here.
2 tasks
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Feb 12, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Feb 13, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Feb 13, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 6, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cp: stable
cherry pick this pull request to stable release candidate branch
engine
flutter/engine related. See also e: labels.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #160933.
The timing of this callback gives our users (and plugin authors) a chance to stop using the
Surfacebefore it becomes invalid, allowing us to fix #156488 - we no longer need to do shenanigans on storing and restoring state becauseExoPlayercan now handle it out of the box; see #160933 (comment).It's unfortunate we have to go through a bit of churn on the callback API, but realistically this is the feedback we were looking for when originally creating it - it just took longer than expected due to the long release cycle.
/cc @hasali19, @xxoo, @camsim99