registerLocalVideoProcessor method

FutureOr<int> registerLocalVideoProcessor(
  1. id<ByteRTCVideoProcessorDelegate> processor,
  2. ByteRTCVideoPreprocessorConfig config
)

@detail api @hiddensdk(audiosdk) @author zhushufan.ref @brief Set up a custom video preprocessor.
Using this video preprocessor, you can call processVideoFrame:{@link #ByteRTCVideoProcessorDelegate#processVideoFrame} to preprocess the video frames captured by the RTC SDK and use the processed video frames for RTC audio & video communication. @param processor Custom video processor. See ByteRTCVideoProcessorDelegate{@link #ByteRTCVideoProcessorDelegate}. If null is passed in, the video frames captured by the RTC SDK are not preprocessed.
SDK only holds weak references to the processor, you should guarantee its Life Time.
When designing the'processor ', the video frame data should be obtained from the'textureBuf' field of ByteRTCVideoFrame{@link #ByteRTCVideoFrame};
The video frame data returned after processing should be in the format of'ByteRTCVideoPixelFormat 'in ByteRTCVideoPixelFormat{@link #ByteRTCVideoPixelFormat}, and must be stored in the'textureBuf' field that returns the frame data. @param config Customize the settings applicable to the video preprocessor. See ByteRTCVideoPreprocessorConfig{@link #ByteRTCVideoPreprocessorConfig}.
Currently, the 'required_pixel_format 'in'config' only supports: 'ByteRTCVideoPixelFormatI420' and'ByteRTCVideoPixelFormatUnknown ':
- When set to'Unknown', the RTC SDK gives the format of the video frame for processing by the processor, that is, the format of the acquisition. - When set to'ByteRTCVideoPixelFormatI420 ', the RTC SDK will convert the captured video into the corresponding format for pre-processing. This method call fails when - Is set to another value. @return - 0: Success. - < 0 : Fail. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for more details. @note - When this interface is called repeatedly, only the last call takes effect. The effects do not stack. - For iOS platforms, setting the requiredPixelFormat in ByteRTCVideoPreprocessorConfig{@link #ByteRTCVideoPreprocessorConfig} to'kVideoPixelFormatUnknown 'brings some performance optimization by avoiding format conversion.

Implementation

FutureOr<int> registerLocalVideoProcessor(
    id<ByteRTCVideoProcessorDelegate> processor,
    ByteRTCVideoPreprocessorConfig config) async {
  return await nativeCall(
      'registerLocalVideoProcessor:withConfig:', [processor, config]);
}