Skip to content

Commit

Permalink
fix: Remove enableGpuBuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Apr 17, 2024
1 parent 5ba004e commit b751f2d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 33 deletions.
7 changes: 0 additions & 7 deletions docs/docs/guides/PERFORMANCE.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ Enable Buffer Compression ([`enableBufferCompression`](/docs/api/interfaces/Came

Note: When not using a `frameProcessor`, buffer compression is automatically enabled.

### GPU buffers

Enable GPU Buffer flags ([`enableGpuBuffers`](/docs/api/interfaces/CameraProps#enablegpubuffers)) to optimize the Video Pipeline for zero-copy buffer forwarding.
If this is enabled, the Video Pipeline can avoid an additional CPU -> GPU copy, resulting in better performance and more efficiency.

Note: This only takes effect when using a `frameProcessor`.

### Video Stabilization

Video Stabilization requires additional overhead to start the algorithm, so disabling [`videoStabilizationMode`](/docs/api/interfaces/CameraProps#videostabilizationmode) can significantly speed up the Camera initialization time.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/TROUBLESHOOTING.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ If you're experiencing build issues or runtime issues in VisionCamera, make sure
2. If a camera device is not being returned by [`Camera.getAvailableCameraDevices()`](/docs/api/classes/Camera#getavailablecameradevices), make sure it is a Camera2 compatible device. See [this section in the Android docs](https://developer.android.com/reference/android/hardware/camera2/CameraDevice#reprocessing) for more information.
3. If your Frame Processor is not running, make sure you check the native Android Studio/Logcat logs. There is useful information about the Frame Processor Runtime that will tell you if something goes wrong.
4. If your Frame Processor is not running, make sure you are not using a remote JS debugger such as Google Chrome, since those don't work with JSI.
5. If you are experiencing black-screens, try removing all properties such as `fps`, `videoHdr`, `enableGpuBuffers` or `format` on the `<Camera>` component except for the required ones:
5. If you are experiencing black-screens, try removing all properties such as `fps`, `videoHdr`, `pixelFormat` or `format` on the `<Camera>` component except for the required ones:
```tsx
<Camera device={device} isActive={true} style={{ width: 500, height: 500 }} />
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class CameraView(context: Context) :
var photoHdr = false
var photoQualityBalance = QualityBalance.BALANCED
var lowLightBoost = false
var enableGpuBuffers = false

// other props
var isActive = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ class CameraViewManager : ViewGroupManager<CameraView>() {
view.enableFpsGraph = enableFpsGraph
}

@ReactProp(name = "enableGpuBuffers")
fun setEnableGpuBuffers(view: CameraView, enableGpuBuffers: Boolean) {
view.enableGpuBuffers = enableGpuBuffers
}

@ReactProp(name = "videoStabilizationMode")
fun setVideoStabilizationMode(view: CameraView, videoStabilizationMode: String?) {
if (videoStabilizationMode != null) {
Expand Down
19 changes: 0 additions & 19 deletions package/src/CameraProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,25 +226,6 @@ export interface CameraProps extends ViewProps {
* - false // otherwise
*/
enableBufferCompression?: boolean
/**
* Enables or disables GPU-sampled buffers for the video stream. This only takes effect when using a {@linkcode frameProcessor}.
*
* When recording a Video ({@linkcode video}) while a Frame Processor is running ({@linkcode frameProcessor}),
* the {@linkcode Frame | Frames} will need to be forwarded to the Media Encoder.
*
* - When `enableGpuBuffers` is `false`, the Video Pipeline will use CPU buffers causing an additional copy
* from the Frame Processor to the Media Encoder, which potentially results in increased latency.
* - When `enableGpuBuffers` is `true`, the Video Pipeline will use shared GPU buffers which greatly increases
* it's efficiency as an additional buffer copy is avoided.
* (See [`USAGE_GPU_SAMPLED_IMAGE`](https://developer.android.com/reference/android/hardware/HardwareBuffer#USAGE_GPU_SAMPLED_IMAGE))
*
* In general, it is recommended to set this to `true` if possible, as this can increase performance and efficiency of the Video Pipeline.
*
* @experimental This is an experimental feature flag, use at your own risk. Some devices (especially Samsungs) may crash when trying to use GPU buffers.
* @platform Android (API 29+)
* @default false
*/
enableGpuBuffers?: boolean
/**
* Enables or disables low-light boost on this camera device.
*
Expand Down

0 comments on commit b751f2d

Please sign in to comment.