android / android/camera-samples

Camera2Video stop failed on certain arguments

Open
#329 4 comments 0 reactions 1 assignee Claimed by @owahltinez View on GitHub
Dominant language
Kotlin
Stars
5.5k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Hello I am testing Camera2Video source code and found error as below

```
2020-11-04 14:55:39.317 30311-3794/com.android.example.camera2.video E/MediaRecorder: stop failed: -1007
2020-11-04 14:55:39.348 30311-3794/com.android.example.camera2.video E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
Process: com.android.example.camera2.video, PID: 30311
java.lang.RuntimeException: stop failed.
at android.media.MediaRecorder._stop(Native Method)
at android.media.MediaRecorder.stop(MediaRecorder.java:1472)
at com.example.android.camera2.video.fragments.CameraFragment$initializeCamera$1$1$2.invokeSuspend(CameraFragment.kt:297)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
```

However when i change camera device session request configuration like below, error does not occur anymore. I am wondering there is any problem with `set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, Range(args.fps, args.fps))`.

```
+++ b/Camera2Video/app/src/main/java/com/example/android/camera2/video/fragments/CameraFragment.kt
@@ -21,7 +21,11 @@ import android.content.Context
import android.content.Intent
import android.media.MediaScannerConnection
@@ -162,7 +166,7 @@ class CameraFragment : Fragment() {
addTarget(viewFinder.holder.surface)
addTarget(recorderSurface)
// Sets user requested FPS for all targets
+ set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO)
- set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, Range(args.fps, args.fps))
}.build()
}

```

This is my device specification

- model number: SM-N971N

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.