Package tvi.webrtc
Interface VideoEncoder
-
- All Known Implementing Classes:
LibvpxVp8Encoder,LibvpxVp9Encoder,VideoEncoderFallback,WrappedNativeVideoEncoder
public interface VideoEncoderInterface for a video encoder that can be used with WebRTC. All calls will be made on the encoding thread. The encoder may be constructed on a different thread and changing thread after calling release is allowed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classVideoEncoder.BitrateAllocationRepresents bitrate allocated for an encoder to produce frames.static interfaceVideoEncoder.Callbackstatic classVideoEncoder.CapabilitiesCapabilities (loss notification, etc.) passed to the encoder by WebRTC.static classVideoEncoder.CodecSpecificInfoCodec specific information about the encoded frame.static classVideoEncoder.CodecSpecificInfoH264static classVideoEncoder.CodecSpecificInfoVP8static classVideoEncoder.CodecSpecificInfoVP9static classVideoEncoder.EncodeInfoAdditional info for encoding.static classVideoEncoder.ResolutionBitrateLimitsBitrate limits for resolution.static classVideoEncoder.ScalingSettingsSettings for WebRTC quality based scaling.static classVideoEncoder.SettingsSettings passed to the encoder by WebRTC.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default longcreateNativeVideoEncoder()The encoder implementation backing this interface is either 1) a Java encoder (e.g., an Android platform encoder), or alternatively 2) a native encoder (e.g., a software encoder or a C++ encoder adapter).VideoCodecStatusencode(VideoFrame frame, VideoEncoder.EncodeInfo info)Requests the encoder to encode a frame.java.lang.StringgetImplementationName()Should return a descriptive name for the implementation.default VideoEncoder.ResolutionBitrateLimits[]getResolutionBitrateLimits()Returns the list of bitrate limits.VideoEncoder.ScalingSettingsgetScalingSettings()Any encoder that wants to use WebRTC provided quality scaler must implement this method.VideoCodecStatusinitEncode(VideoEncoder.Settings settings, VideoEncoder.Callback encodeCallback)Initializes the encoding process.default booleanisHardwareEncoder()Returns true if the encoder is backed by hardware.VideoCodecStatusrelease()Releases the encoder.VideoCodecStatussetRateAllocation(VideoEncoder.BitrateAllocation allocation, int framerate)Sets the bitrate allocation and the target framerate for the encoder.
-
-
-
Method Detail
-
createNativeVideoEncoder
default long createNativeVideoEncoder()
The encoder implementation backing this interface is either 1) a Java encoder (e.g., an Android platform encoder), or alternatively 2) a native encoder (e.g., a software encoder or a C++ encoder adapter). For case 1), createNativeVideoEncoder() should return zero. In this case, we expect the native library to call the encoder through JNI using the Java interface declared below. For case 2), createNativeVideoEncoder() should return a non-zero value. In this case, we expect the native library to treat the returned value as a raw pointer of type webrtc::VideoEncoder* (ownership is transferred to the caller). The native library should then directly call the webrtc::VideoEncoder interface without going through JNI. All calls to the Java interface methods declared below should thus throw an UnsupportedOperationException.
-
isHardwareEncoder
default boolean isHardwareEncoder()
Returns true if the encoder is backed by hardware.
-
initEncode
VideoCodecStatus initEncode(VideoEncoder.Settings settings, VideoEncoder.Callback encodeCallback)
Initializes the encoding process. Call before any calls to encode.
-
release
VideoCodecStatus release()
Releases the encoder. No more calls to encode will be made after this call.
-
encode
VideoCodecStatus encode(VideoFrame frame, VideoEncoder.EncodeInfo info)
Requests the encoder to encode a frame.
-
setRateAllocation
VideoCodecStatus setRateAllocation(VideoEncoder.BitrateAllocation allocation, int framerate)
Sets the bitrate allocation and the target framerate for the encoder.
-
getScalingSettings
VideoEncoder.ScalingSettings getScalingSettings()
Any encoder that wants to use WebRTC provided quality scaler must implement this method.
-
getResolutionBitrateLimits
default VideoEncoder.ResolutionBitrateLimits[] getResolutionBitrateLimits()
Returns the list of bitrate limits.
-
getImplementationName
java.lang.String getImplementationName()
Should return a descriptive name for the implementation. Gets called once and cached. May be called from arbitrary thread.
-
-