Module webrtc.java

Class NativeI420Buffer

  • All Implemented Interfaces:
    dev.onvoid.webrtc.internal.RefCounted, I420Buffer, VideoFrameBuffer

    public class NativeI420Buffer
    extends dev.onvoid.webrtc.internal.RefCountedObject
    implements I420Buffer
    This class wraps the native WebRTC I420BufferInterface.
    • Method Detail

      • getDataY

        public ByteBuffer getDataY()
        Description copied from interface: I420Buffer
        Returns a direct ByteBuffer containing Y-plane data. The buffer capacity is at least getStrideY() * getHeight() bytes. The position of the returned buffer is ignored and must be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so implementations must return a new ByteBuffer or slice for each call.
        Specified by:
        getDataY in interface I420Buffer
      • getDataU

        public ByteBuffer getDataU()
        Description copied from interface: I420Buffer
        Returns a direct ByteBuffer containing U-plane data. The buffer capacity is at least getStrideU() * ((getHeight() + 1) / 2) bytes. The position of the returned buffer is ignored and must be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so implementations must return a new ByteBuffer or slice for each call.
        Specified by:
        getDataU in interface I420Buffer
      • getDataV

        public ByteBuffer getDataV()
        Description copied from interface: I420Buffer
        Returns a direct ByteBuffer containing V-plane data. The buffer capacity is at least getStrideV() * ((getHeight() + 1) / 2) bytes. The position of the returned buffer is ignored and must be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so implementations must return a new ByteBuffer or slice for each call.
        Specified by:
        getDataV in interface I420Buffer
      • toI420

        public I420Buffer toI420()
        Description copied from interface: VideoFrameBuffer
        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.
        Specified by:
        toI420 in interface VideoFrameBuffer
      • cropAndScale

        public VideoFrameBuffer cropAndScale​(int cropX,
                                             int cropY,
                                             int cropWidth,
                                             int cropHeight,
                                             int scaleWidth,
                                             int scaleHeight)
        Description copied from interface: VideoFrameBuffer
        Crops a region defined by |cropx|, |cropY|, |cropWidth| and |cropHeight|. Scales it to size |scaleWidth| x |scaleHeight|.
        Specified by:
        cropAndScale in interface VideoFrameBuffer
      • allocate

        public static NativeI420Buffer allocate​(int width,
                                                int height)
        Allocates an empty I420Buffer suitable for an image of the given dimensions.