Skip to content

Commit

Permalink
fix: Fix zoom/torch/exposure not being applied when switching `…
Browse files Browse the repository at this point in the history
…device` (#3066)
  • Loading branch information
mrousavy authored Jul 10, 2024
1 parent a01c050 commit 37525a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ data class CameraConfiguration(
fun copyOf(other: CameraConfiguration?): CameraConfiguration = other?.copy() ?: CameraConfiguration()

fun difference(left: CameraConfiguration?, right: CameraConfiguration): Difference {
// input device
val deviceChanged = left?.cameraId != right.cameraId

// outputs
val outputsChanged = left?.photo != right.photo ||
left.video != right.video ||
Expand All @@ -136,8 +133,11 @@ data class CameraConfiguration(
left.format != right.format ||
left.fps != right.fps

// input device
val deviceChanged = outputsChanged || left?.cameraId != right.cameraId

// repeating request
val sidePropsChanged = outputsChanged ||
val sidePropsChanged = deviceChanged ||
left?.torch != right.torch ||
left.zoom != right.zoom ||
left.exposure != right.exposure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class CameraSession(internal val context: Context, internal val callback: Callba
// 1.1. whenever the outputs changed, we need to update their orientation as well
configureOrientation()
}
if (diff.deviceChanged || diff.outputsChanged) {
if (diff.deviceChanged) {
// 2. input or outputs changed, or the session was destroyed from outside, rebind the session
configureCamera(provider, config)
}
Expand Down

0 comments on commit 37525a2

Please sign in to comment.