Package tvi.webrtc
Class VideoFrame
java.lang.Object
tvi.webrtc.VideoFrame
- All Implemented Interfaces:
RefCounted
Java version of webrtc::VideoFrame and webrtc::VideoFrameBuffer. A difference from the C++
version is that no explicit tag is used, and clients are expected to use 'instanceof' to find the
right subclass of the buffer. This allows clients to create custom VideoFrame.Buffer in
arbitrary format in their custom VideoSources, and then cast it back to the correct subclass in
their custom VideoSinks. All implementations must also implement the toI420() function,
converting from the underlying representation if necessary. I420 is the most widely accepted
format and serves as a fallback for video sinks that can only handle I420, e.g. the internal
WebRTC software encoders.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Implements image storage medium.static interface
Interface for I420 buffers.static interface
Interface for buffers that are stored as a single texture, either in OES or RGB format. -
Constructor Summary
ConstructorDescriptionVideoFrame
(VideoFrame.Buffer buffer, int rotation, long timestampNs) Constructs a new VideoFrame backed by the givenbuffer
. -
Method Summary
-
Constructor Details
-
VideoFrame
Constructs a new VideoFrame backed by the givenbuffer
. Note: Ownership of the buffer object is tranferred to the new VideoFrame.
-
-
Method Details
-
getBuffer
-
getRotation
public int getRotation()Rotation of the frame in degrees. -
getTimestampNs
public long getTimestampNs()Timestamp of the frame in nano seconds. -
getRotatedWidth
public int getRotatedWidth() -
getRotatedHeight
public int getRotatedHeight() -
retain
public void retain()Description copied from interface:RefCounted
Increases ref count by one.- Specified by:
retain
in interfaceRefCounted
-
release
public void release()Description copied from interface:RefCounted
Decreases ref count by one. When the ref count reaches zero, resources related to the object will be freed.- Specified by:
release
in interfaceRefCounted
-