feat: Add support for Buffer Compression for a more efficient Video Pipeline (enableBufferCompression
) (#1828)
feat: Add support for Buffer Compression for more efficient Video Pipeline (`enableBufferCompression`)
This commit is contained in:
@@ -403,6 +403,8 @@ export class Camera extends React.PureComponent<CameraProps> {
|
||||
);
|
||||
}
|
||||
|
||||
const shouldEnableBufferCompression = props.video === true && frameProcessor == null;
|
||||
|
||||
return (
|
||||
<NativeCameraView
|
||||
{...props}
|
||||
@@ -412,6 +414,7 @@ export class Camera extends React.PureComponent<CameraProps> {
|
||||
onInitialized={this.onInitialized}
|
||||
onError={this.onError}
|
||||
enableFrameProcessor={frameProcessor != null}
|
||||
enableBufferCompression={props.enableBufferCompression ?? shouldEnableBufferCompression}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@@ -123,6 +123,27 @@ export interface CameraProps extends ViewProps {
|
||||
* Requires `format` to be set.
|
||||
*/
|
||||
hdr?: boolean;
|
||||
/**
|
||||
* Enables or disables lossless buffer compression for the video stream.
|
||||
* If you only use {@linkcode video} or a {@linkcode frameProcessor}, this
|
||||
* can increase the efficiency and lower memory usage of the Camera.
|
||||
*
|
||||
* If buffer compression is enabled, the video pipeline will try to use a
|
||||
* lossless-compressed pixel format instead of the normal one.
|
||||
*
|
||||
* If you use a {@linkcode frameProcessor}, you might need to change how pixels
|
||||
* are read inside your native frame processor function as this is different
|
||||
* from the usual `yuv` or `rgb` layout.
|
||||
*
|
||||
* If buffer compression is not available but this property is enabled, the normal
|
||||
* pixel formats will be used and no error will be thrown.
|
||||
*
|
||||
* @platform iOS
|
||||
* @default
|
||||
* - true // if video={true} and frameProcessor={undefined}
|
||||
* - false // otherwise
|
||||
*/
|
||||
enableBufferCompression?: boolean;
|
||||
/**
|
||||
* Enables or disables low-light boost on this camera device. Make sure the given `format` supports low-light boost.
|
||||
*
|
||||
|
Reference in New Issue
Block a user