diff --git a/ringrtc/rffi/api/media.h b/ringrtc/rffi/api/media.h index 1e7d2bf895..7401cd0152 100644 --- a/ringrtc/rffi/api/media.h +++ b/ringrtc/rffi/api/media.h @@ -91,6 +91,10 @@ RUSTEXPORT void Rust_convertVideoFrameBufferToRgba( RUSTEXPORT const uint8_t *Rust_getVideoFrameBufferAsI420( const webrtc::VideoFrameBuffer* buffer); +// See VideoFrameBuffer::Scale. Output will be in I420. +RUSTEXPORT webrtc::VideoFrameBuffer* Rust_scaleVideoFrameBuffer( + webrtc::VideoFrameBuffer* buffer_borrowed_rc, int width, int height); + // RGBA => I420 RUSTEXPORT webrtc::VideoFrameBuffer* Rust_copyAndRotateVideoFrameBuffer( const webrtc::VideoFrameBuffer* buffer_borrowed_rc, webrtc::VideoRotation rotation); diff --git a/ringrtc/rffi/src/media.cc b/ringrtc/rffi/src/media.cc index 826b9f3618..8ed4b1c45c 100644 --- a/ringrtc/rffi/src/media.cc +++ b/ringrtc/rffi/src/media.cc @@ -201,6 +201,12 @@ RUSTEXPORT const uint8_t *Rust_getVideoFrameBufferAsI420(const VideoFrameBuffer* return dataY; } +// Returns an owned RC. +RUSTEXPORT VideoFrameBuffer* Rust_scaleVideoFrameBuffer( + VideoFrameBuffer* buffer_borrowed_rc, int width, int height) { + return take_rc(buffer_borrowed_rc->Scale(width, height)); +} + // Returns an owned RC. RUSTEXPORT VideoFrameBuffer* Rust_copyAndRotateVideoFrameBuffer( const VideoFrameBuffer* buffer_borrowed_rc, VideoRotation rotation) {