Fixed
Status Update
Comments
er...@google.com <er...@google.com>
ap...@google.com <ap...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
ap...@google.com <ap...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 776f4998f2996afd88ffd87e90580d7edf671743
Author: Scott Nien <scottnien@google.com>
Date: Tue May 12 14:20:09 2020
Change getSurfaceProvider to onSurfaceRequested and add waitForNextFrame in PreviewImplementation
(1) PreviewImplementatin#getSurfaceProvider() is changed to
onSurfaceRequested(). Besides a SurfaceRequest parameter, a
listener can also be set to be notified when the surface is no
longer in use or the SurfaceRequest is cancelled before a
surfaced is provided.
The listener can be used in PreviewView as a signal that the
SurfaceRequest and the camera is no longer associated with the PreviewView and we can do some
cleaning.
(2) Add waitForNextFrame() in PreviewViewImplementation.
It returns a ListenbleFuture for PreviewView to be wait for the next frame being ready.
Bug: 154652477
Test: TextureViewImplementationTest, SurfaceViewImplementationTest
Change-Id: If054210b08cb8ddde6f8107f7bf18b3faeeade1a
M camera/camera-view/build.gradle
M camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewTest.java
A camera/camera-view/src/androidTest/java/androidx/camera/view/SurfaceViewImplementationTest.kt
M camera/camera-view/src/androidTest/java/androidx/camera/view/TextureViewImplementationTest.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewView.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewViewImplementation.java
M camera/camera-view/src/main/java/androidx/camera/view/SurfaceViewImplementation.java
M camera/camera-view/src/main/java/androidx/camera/view/TextureViewImplementation.java
https://android-review.googlesource.com/1309276
Branch: androidx-master-dev
commit 776f4998f2996afd88ffd87e90580d7edf671743
Author: Scott Nien <scottnien@google.com>
Date: Tue May 12 14:20:09 2020
Change getSurfaceProvider to onSurfaceRequested and add waitForNextFrame in PreviewImplementation
(1) PreviewImplementatin#getSurfaceProvider() is changed to
onSurfaceRequested(). Besides a SurfaceRequest parameter, a
listener can also be set to be notified when the surface is no
longer in use or the SurfaceRequest is cancelled before a
surfaced is provided.
The listener can be used in PreviewView as a signal that the
SurfaceRequest and the camera is no longer associated with the PreviewView and we can do some
cleaning.
(2) Add waitForNextFrame() in PreviewViewImplementation.
It returns a ListenbleFuture for PreviewView to be wait for the next frame being ready.
Bug: 154652477
Test: TextureViewImplementationTest, SurfaceViewImplementationTest
Change-Id: If054210b08cb8ddde6f8107f7bf18b3faeeade1a
M camera/camera-view/build.gradle
M camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewTest.java
A camera/camera-view/src/androidTest/java/androidx/camera/view/SurfaceViewImplementationTest.kt
M camera/camera-view/src/androidTest/java/androidx/camera/view/TextureViewImplementationTest.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewView.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewViewImplementation.java
M camera/camera-view/src/main/java/androidx/camera/view/SurfaceViewImplementation.java
M camera/camera-view/src/main/java/androidx/camera/view/TextureViewImplementation.java
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit ac3f0116e47f63c570465b7bf33d7482fb8fdb46
Author: Scott Nien <scottnien@google.com>
Date: Fri May 01 01:25:40 2020
Add getPreviewStreamState to PreviewView
(1) Attach Camera instead of CameraInfo in SurfaceRequest because
we need to know the state of Camera.
(2) addOberver to camera.getCameraState() when onSurfaceRequested,
removeObserver when OnSurfaceNotInUseListener is called .
(3) When camera is opening/opened, start the flow to wait for
session capture result event and the next frame event to
change the STREAMSTATE
(4) When camera is closing/closed/releasing, change back to
IDLE and stop the flow.
Preview StreamState has 2 states
IDLE: preview not visible
STREAMING: preview is visible and streaming
(onCaptureCompleted and then frame updated.)
Relnote: "Add `PreviewView#getPreviewStreamState` API which
allows apps to observe if preview is streaming or not. When
the PreviewView is in TEXTURE_VIEW mode, the STREAMING state
also guarantees the preview image is visible."
Bug: 154652477
Test: PreviewViewStreamStateTest
Change-Id: Ic0906d25aa89b3b1a9abb02ca42e15f676b1c72f
M camera/camera-core/src/androidTest/java/androidx/camera/core/SurfaceRequestTest.java
M camera/camera-core/src/main/java/androidx/camera/core/Preview.java
M camera/camera-core/src/main/java/androidx/camera/core/SurfaceRequest.java
A camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewStreamStateTest.kt
M camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewTest.java
M camera/camera-view/src/androidTest/java/androidx/camera/view/SurfaceViewImplementationTest.kt
M camera/camera-view/src/androidTest/java/androidx/camera/view/TextureViewImplementationTest.java
A camera/camera-view/src/main/java/androidx/camera/view/PreviewStreamStateObserver.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewView.java
M camera/camera-view/src/test/java/androidx/camera/view/PreviewViewTest.java
https://android-review.googlesource.com/1299378
Branch: androidx-master-dev
commit ac3f0116e47f63c570465b7bf33d7482fb8fdb46
Author: Scott Nien <scottnien@google.com>
Date: Fri May 01 01:25:40 2020
Add getPreviewStreamState to PreviewView
(1) Attach Camera instead of CameraInfo in SurfaceRequest because
we need to know the state of Camera.
(2) addOberver to camera.getCameraState() when onSurfaceRequested,
removeObserver when OnSurfaceNotInUseListener is called .
(3) When camera is opening/opened, start the flow to wait for
session capture result event and the next frame event to
change the STREAMSTATE
(4) When camera is closing/closed/releasing, change back to
IDLE and stop the flow.
Preview StreamState has 2 states
IDLE: preview not visible
STREAMING: preview is visible and streaming
(onCaptureCompleted and then frame updated.)
Relnote: "Add `PreviewView#getPreviewStreamState` API which
allows apps to observe if preview is streaming or not. When
the PreviewView is in TEXTURE_VIEW mode, the STREAMING state
also guarantees the preview image is visible."
Bug: 154652477
Test: PreviewViewStreamStateTest
Change-Id: Ic0906d25aa89b3b1a9abb02ca42e15f676b1c72f
M camera/camera-core/src/androidTest/java/androidx/camera/core/SurfaceRequestTest.java
M camera/camera-core/src/main/java/androidx/camera/core/Preview.java
M camera/camera-core/src/main/java/androidx/camera/core/SurfaceRequest.java
A camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewStreamStateTest.kt
M camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewTest.java
M camera/camera-view/src/androidTest/java/androidx/camera/view/SurfaceViewImplementationTest.kt
M camera/camera-view/src/androidTest/java/androidx/camera/view/TextureViewImplementationTest.java
A camera/camera-view/src/main/java/androidx/camera/view/PreviewStreamStateObserver.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewView.java
M camera/camera-view/src/test/java/androidx/camera/view/PreviewViewTest.java
sc...@google.com <sc...@google.com>
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 921f54f9bd1c6f2d787a1d9290ff7e45fbefbfec
Author: Xi Zhang <xizh@google.com>
Date: Wed May 20 14:38:42 2020
Bugfix: do not notify the same IDLE state.
Have one place to post the stream state so the same state won't get posted twice.
Bug: 154652477
Test: manual test and ./gradlew bOS
Change-Id: Ia170cc5813fb23812a336314efd2dcaa340743a7
M camera/camera-view/src/main/java/androidx/camera/view/PreviewStreamStateObserver.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewView.java
https://android-review.googlesource.com/1315449
Branch: androidx-master-dev
commit 921f54f9bd1c6f2d787a1d9290ff7e45fbefbfec
Author: Xi Zhang <xizh@google.com>
Date: Wed May 20 14:38:42 2020
Bugfix: do not notify the same IDLE state.
Have one place to post the stream state so the same state won't get posted twice.
Bug: 154652477
Test: manual test and ./gradlew bOS
Change-Id: Ia170cc5813fb23812a336314efd2dcaa340743a7
M camera/camera-view/src/main/java/androidx/camera/view/PreviewStreamStateObserver.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewView.java
l....@gmail.com <l....@gmail.com> #7
It showing, marked as fixed.
When can we expect this fix be available for us to consume?
Also please let us know interface changes as well.
Regards,
Venkatesh.
On Fri, May 22, 2020 at 12:54 AM <buganizer-system@google.com> wrote:
When can we expect this fix be available for us to consume?
Also please let us know interface changes as well.
Regards,
Venkatesh.
On Fri, May 22, 2020 at 12:54 AM <buganizer-system@google.com> wrote:
sc...@google.com <sc...@google.com> #8
Hi Venkatesh,
The new API will be in beta04/alpha-11 release scheduled at May 27th. (Pacific time).
You will need to update the core/camera2/lifecycle to beta04, and camera-view to alpha-11.
It is just a new API in PreviewView which returns a LiveData of StreamStates.
StreamState.IDLE --> PreviewView is not showing preview yet.
StreamState.STREAMING -->. Preview is streaming and visible(guaranteed only in TEXTURE_VIEW mode only).
To use it , you can add observer to it like the following:
previewView.getPreviewStreamState().observe( lifecycleOwner,
streamState -> {
if (streamState == IDLE) {
// Show the overlay to hide the preview.
} else if (streamState == STREAMING) {
// hide the overlay to show the preview,
}
}
);
please note you have to setPreferredImplementation to TEXTURE_VIEW to ensure that preview is visible when in STREAMING state.
(there could be a minor latency for preview to be visible in SURFACE_VIEW mode).
Scott
The new API will be in beta04/alpha-11 release scheduled at May 27th. (Pacific time).
You will need to update the core/camera2/lifecycle to beta04, and camera-view to alpha-11.
It is just a new API in PreviewView which returns a LiveData of StreamStates.
StreamState.IDLE --> PreviewView is not showing preview yet.
StreamState.STREAMING -->. Preview is streaming and visible(guaranteed only in TEXTURE_VIEW mode only).
To use it , you can add observer to it like the following:
previewView.getPreviewStreamState().observe( lifecycleOwner,
streamState -> {
if (streamState == IDLE) {
// Show the overlay to hide the preview.
} else if (streamState == STREAMING) {
// hide the overlay to show the preview,
}
}
);
please note you have to setPreferredImplementation to TEXTURE_VIEW to ensure that preview is visible when in STREAMING state.
(there could be a minor latency for preview to be visible in SURFACE_VIEW mode).
Scott
l....@gmail.com <l....@gmail.com> #9
Super!!
Thanks a lot Scott!!!
Regards,
Venkatesh.
Thanks a lot Scott!!!
Regards,
Venkatesh.
Description
Please describe your issue and include details such as the version of CameraX you are using and any relevant logs related to your issue.
// If at all possible, capture an Android logcat (
CAMERAX VERSION (ex - 1.0.0-alpha07)
beta-01
CAMERA APPLICATION NAME AND VERSION: (Settings > Apps > (app name) > version)
ANDROID OS BUILD NUMBER: (Settings > About > Build number)
DEVICE NAME: (Nexus 5X, Samsung S6, etc)
DESCRIPTION:
Forum link :
LIST ANY EXPERIMENTAL FEATURES: (As an example - @ExperimentalCamera2Interop)
STEPS TO REPRODUCE:
1.
2.
3.
OBSERVED RESULTS:
EXPECTED RESULTS:
REPRODUCIBILITY: (5 of 5, 1 of 100, etc)
ADDITIONAL INFORMATION:
CODE FRAGMENTS (this will help us troubleshoot your issues):