Skip to content

VideoFilter

Adnan Mujagić edited this page Jun 11, 2024 · 1 revision

Note: Your video filter implementation needs to implement this protocol. For example implementations that fit common use cases, take a look at our RTC extensions library.



start(resolution, sourceFps, videoFilterManager)

Description

Initialize the video filter with the specified parameters and prepare to process video frames.

Arguments

  • resolution: CGSize - A structure that contains width and height values of the source camera stream.
  • sourceFps: Int - The framerate of the source camera stream.
  • videoFilterManager: VideoFilterManager - The video filter manager currently using this video filter.

Returns

  • N/A



applyFilter(ciImage, rotation, timeStampNs, completion)

Description

Called once per frame. This should execute the filter logic and generate a new frame containing the filtered frame to use as video output. Once the filtered frame is ready, the video filter should be notified through completion handler. The supplied frame is encoded and sent as video output.

Arguments

  • ciImage: CIImage? - The raw image that the filtering logic should be performed on.
  • rotation: Int - The rotation of the frame. Useful if your filtering logic needs to know whether the video isn't upright (e.g. device is upside down).
  • timeStampNs: Int - Timestamp of the frame in nanoseconds.
  • completion: (ciImage: CIImage) -> Void - The completion which should be called to supply a filtered image. The supplied CIImage is then encoded and sent as video output.

Returns

  • N/A



stop()

Description

Stop the video filter. All associated resources should be deallocated as the video filter may not be started again and the instance could be discarded. A stopped filter may be started again, using the start method. This method is guaranteed to be called exactly once after each invocation of start, including if the initialization fails.

Arguments

  • none

Returns

  • N/A

Tutorials

Migration guides

Reference documentation

Clone this wiki locally