Support injecting custom native codecs from Java.
This CL extends our support for injecting native codecs such that
downstream users can create Java codecs that are backed by custom
native codecs.
After this CL, the Java codec interfaces expose
createNativeVideo{En,Decoder}() methods that may return a value
representing a pointer to the backing native codec. Previously,
a similar mechanism was used for the special case of non-public
Java codecs extending from the internal
WrappedNativeVideo{En,De}coder classes.
Tested: AppRTCMobile on Pixel XL and Pixel 2.
Bug: webrtc:9495
Change-Id: I079ff744afc7bf9873ff983e775c136a6667266d
Reviewed-on: https://webrtc-review.googlesource.com/87264
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23883}
This commit is contained in:
committed by
Commit Bot
parent
c75a5e8dd6
commit
42a2fc9cba
@ -163,6 +163,36 @@ public interface VideoEncoder {
|
||||
void onEncodedFrame(EncodedImage frame, CodecSpecificInfo info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@CalledByNative
|
||||
default long createNativeVideoEncoder() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the encoder is backed by hardware.
|
||||
*/
|
||||
@CalledByNative
|
||||
default boolean isHardwareEncoder() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the encoding process. Call before any calls to encode.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user