Skip to content

Commit

Permalink
Merge changes I85056cec,I931e8fe9 into androidx-main
Browse files Browse the repository at this point in the history
* changes:
  API-Compat Preview: Add preview stabilization, dynamic range and frame rate tests
  implement SurfaceProvider RESULT_INVALID_SURFACE result codes
  • Loading branch information
Treehugger Robot authored and Gerrit Code Review committed Nov 9, 2024
2 parents 5497e2a + 4f2054d commit 4d91d7a
Show file tree
Hide file tree
Showing 3 changed files with 317 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,14 @@ public boolean isPrimary() {
*/
public void provideSurface(@NonNull Surface surface, @NonNull Executor executor,
@NonNull Consumer<Result> resultListener) {
if (!surface.isValid()) {
// Only check Surface validness. The resolution match check might cause unexpected
// compatibility issue.
executor.execute(
() -> resultListener.accept(
Result.of(Result.RESULT_INVALID_SURFACE, surface)));
}

if (mSurfaceCompleter.set(surface) || mSurfaceFuture.isCancelled()) {
// Session will be pending completion (or surface request was cancelled). Return the
// session future.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package androidx.camera.video
import android.content.Context
import android.graphics.Matrix
import android.graphics.Rect
import android.graphics.SurfaceTexture
import android.media.CamcorderProfile.QUALITY_1080P
import android.media.CamcorderProfile.QUALITY_2160P
import android.media.CamcorderProfile.QUALITY_480P
Expand Down Expand Up @@ -896,7 +897,7 @@ class VideoCaptureTest {

var surfaceResult: SurfaceRequest.Result? = null
val videoOutput = createVideoOutput { surfaceRequest, _ ->
surfaceRequest.provideSurface(mock(Surface::class.java), directExecutor()) {
surfaceRequest.provideSurface(Surface(SurfaceTexture(0)), directExecutor()) {
surfaceResult = it
}
}
Expand Down Expand Up @@ -925,7 +926,7 @@ class VideoCaptureTest {

var surfaceResult: SurfaceRequest.Result? = null
val videoOutput = createVideoOutput { surfaceRequest, _ ->
surfaceRequest.provideSurface(mock(Surface::class.java), directExecutor()) {
surfaceRequest.provideSurface(Surface(SurfaceTexture(0)), directExecutor()) {
surfaceResult = it
}
}
Expand Down Expand Up @@ -1407,7 +1408,10 @@ class VideoCaptureTest {
val videoOutput =
createVideoOutput(
surfaceRequestListener = { surfaceRequest, _ ->
surfaceRequest.provideSurface(mock(Surface::class.java), mainThreadExecutor()) {
surfaceRequest.provideSurface(
Surface(SurfaceTexture(0)),
mainThreadExecutor()
) {
appSurfaceReadyToRelease = true
}
}
Expand Down
Loading

0 comments on commit 4d91d7a

Please sign in to comment.