三星S9调用camera2 createConstrainedHighSpeedCaptureSession失败问题咨询
Let’s work through this issue together: you’re hitting CAMERA_ERROR (3): endConfigure:442: Camera 0: Error configuring streams: Broken pipe (-32) when running mCameraDevice.createConstrainedHighSpeedCaptureSession(surfaces, stateCallback , mBackgroundHandler); on a Samsung S9, but it works flawlessly on the S8. Even other apps that support HighSpeedCaptureSession fail on your S9—this points to either a hardware/firmware limitation on the S9 or a specific compatibility quirk we can address in code. Here are actionable steps to try:
1. Verify High-Speed Stream Configuration Parameters
Samsung S9’s camera hardware has stricter rules for high-speed capture sessions compared to the S8. Double-check these details:
- Stick to S9’s supported high-res modes: Many devices only allow 1080p@120fps for high-speed capture—higher resolutions like 4K might not be compatible. Check the camera’s
StreamConfigurationMapfor valid high-speed sizes usinggetHighSpeedVideoSizes(). - Use standard formats: High-speed sessions typically require
YUV_420_888for preview surfaces andH.264for recording. Avoid niche formats that the S9’s camera HAL might not support. - Minimize concurrent streams: Try starting with just a preview surface first, then add the recording surface after the session is initialized. Too many streams at once can trigger pipe errors.
2. Adjust Session Creation Timing & Flow
Sometimes the order or timing of surface initialization causes this error:
- Wait for surfaces to fully initialize: Ensure your
TextureVieworSurfaceViewhas completed itssurfaceCreated()callback before passing surfaces to the high-speed session. - Try a two-step session setup: Some Samsung devices require creating a regular
CaptureSessionfirst, then switching to a constrained high-speed session. This helps the camera HAL warm up properly. - Validate your background handler: Make sure
mBackgroundHandleris tied to a dedicated camera thread (not the UI thread). High-speed session operations are sensitive to thread context.
3. Samsung-Specific Workarounds
Samsung’s custom camera framework often needs special handling:
- Disable conflicting camera features: Turn off features like beauty mode, HDR, or optical image stabilization (OIS) before initializing the high-speed session—these can interfere with high-speed capture.
- Check system-level restrictions: Ensure your app has proper camera permissions (including background access if needed) and that the device isn’t in power-saving mode (which throttles camera performance).
- Fallback to Camera1 API (if possible): While Camera1 is deprecated, some Samsung devices have more stable high-speed recording support via Camera1’s
setPreviewFpsRange()and media recorder configuration.
4. Update Device Firmware
This could be a firmware-specific bug on the S9:
- Install the latest OneUI update: Samsung regularly patches camera-related bugs in system updates. Check for and install any available firmware updates.
- Revert to official ROM: If you’re using a custom ROM, switch back to the stock firmware—third-party ROMs often modify the camera HAL, breaking compatibility with high-speed features.
Since other high-speed capture apps also fail on your S9, this is likely a device-level issue (either a hidden hardware limitation or a firmware bug). If none of the above fixes work, you might need to reach out to Samsung’s support to confirm if your specific S9 model/region actually supports ConstrainedHighSpeedCaptureSession (sometimes official specs don’t match real-world behavior).
内容的提问来源于stack exchange,提问作者Ivan

