diff --git a/api/video/video_frame_buffer.h b/api/video/video_frame_buffer.h index 3e12c75a45..7b0782f9c4 100644 --- a/api/video/video_frame_buffer.h +++ b/api/video/video_frame_buffer.h @@ -69,6 +69,8 @@ class RTC_EXPORT VideoFrameBuffer : public rtc::RefCountInterface { // in another format, a conversion will take place. All implementations must // provide a fallback to I420 for compatibility with e.g. the internal WebRTC // software encoders. + // Conversion may fail, for example if reading the pixel data from a texture + // fails. If the conversion fails, nullptr is returned. virtual rtc::scoped_refptr ToI420() = 0; // GetI420() methods should return I420 buffer if conversion is trivial, i.e diff --git a/sdk/android/api/org/webrtc/VideoFrame.java b/sdk/android/api/org/webrtc/VideoFrame.java index 006635459e..e9f3b52455 100644 --- a/sdk/android/api/org/webrtc/VideoFrame.java +++ b/sdk/android/api/org/webrtc/VideoFrame.java @@ -13,6 +13,7 @@ package org.webrtc; import android.graphics.Matrix; import android.opengl.GLES11Ext; import android.opengl.GLES20; +import androidx.annotation.Nullable; import java.nio.ByteBuffer; /** @@ -53,8 +54,11 @@ public class VideoFrame implements RefCounted { * Returns a memory-backed frame in I420 format. If the pixel data is in another format, a * conversion will take place. All implementations must provide a fallback to I420 for * compatibility with e.g. the internal WebRTC software encoders. + * + *

Conversion may fail, for example if reading the pixel data from a texture fails. If the + * conversion fails, null is returned. */ - @CalledByNative("Buffer") I420Buffer toI420(); + @Nullable @CalledByNative("Buffer") I420Buffer toI420(); @Override @CalledByNative("Buffer") void retain(); @Override @CalledByNative("Buffer") void release();