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
@ -12,7 +12,7 @@ package org.webrtc;
|
||||
|
||||
class VP8Decoder extends WrappedNativeVideoDecoder {
|
||||
@Override
|
||||
long createNativeDecoder() {
|
||||
public long createNativeVideoDecoder() {
|
||||
return nativeCreateDecoder();
|
||||
}
|
||||
|
||||
|
||||
@ -12,14 +12,14 @@ package org.webrtc;
|
||||
|
||||
class VP8Encoder extends WrappedNativeVideoEncoder {
|
||||
@Override
|
||||
long createNativeEncoder() {
|
||||
public long createNativeVideoEncoder() {
|
||||
return nativeCreateEncoder();
|
||||
}
|
||||
|
||||
static native long nativeCreateEncoder();
|
||||
|
||||
@Override
|
||||
boolean isSoftwareEncoder() {
|
||||
return true;
|
||||
public boolean isHardwareEncoder() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ package org.webrtc;
|
||||
|
||||
class VP9Decoder extends WrappedNativeVideoDecoder {
|
||||
@Override
|
||||
long createNativeDecoder() {
|
||||
public long createNativeVideoDecoder() {
|
||||
return nativeCreateDecoder();
|
||||
}
|
||||
|
||||
|
||||
@ -12,15 +12,15 @@ package org.webrtc;
|
||||
|
||||
class VP9Encoder extends WrappedNativeVideoEncoder {
|
||||
@Override
|
||||
long createNativeEncoder() {
|
||||
public long createNativeVideoEncoder() {
|
||||
return nativeCreateEncoder();
|
||||
}
|
||||
|
||||
static native long nativeCreateEncoder();
|
||||
|
||||
@Override
|
||||
boolean isSoftwareEncoder() {
|
||||
return true;
|
||||
public boolean isHardwareEncoder() {
|
||||
return false;
|
||||
}
|
||||
|
||||
static native boolean nativeIsSupported();
|
||||
|
||||
@ -14,7 +14,7 @@ package org.webrtc;
|
||||
* Wraps a native webrtc::VideoDecoder.
|
||||
*/
|
||||
abstract class WrappedNativeVideoDecoder implements VideoDecoder {
|
||||
@CalledByNative abstract long createNativeDecoder();
|
||||
@Override public abstract long createNativeVideoDecoder();
|
||||
|
||||
@Override
|
||||
public VideoCodecStatus initDecode(Settings settings, Callback decodeCallback) {
|
||||
@ -40,9 +40,4 @@ abstract class WrappedNativeVideoDecoder implements VideoDecoder {
|
||||
public String getImplementationName() {
|
||||
throw new UnsupportedOperationException("Not implemented.");
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
static boolean isInstanceOf(VideoDecoder decoder) {
|
||||
return decoder instanceof WrappedNativeVideoDecoder;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,9 +14,8 @@ package org.webrtc;
|
||||
* Wraps a native webrtc::VideoEncoder.
|
||||
*/
|
||||
abstract class WrappedNativeVideoEncoder implements VideoEncoder {
|
||||
@CalledByNative abstract long createNativeEncoder();
|
||||
|
||||
abstract boolean isSoftwareEncoder();
|
||||
@Override public abstract long createNativeVideoEncoder();
|
||||
@Override public abstract boolean isHardwareEncoder();
|
||||
|
||||
@Override
|
||||
public VideoCodecStatus initEncode(Settings settings, Callback encodeCallback) {
|
||||
@ -52,15 +51,4 @@ abstract class WrappedNativeVideoEncoder implements VideoEncoder {
|
||||
public String getImplementationName() {
|
||||
throw new UnsupportedOperationException("Not implemented.");
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
static boolean isWrappedSoftwareEncoder(VideoEncoder encoder) {
|
||||
return (encoder instanceof WrappedNativeVideoEncoder)
|
||||
&& ((WrappedNativeVideoEncoder) encoder).isSoftwareEncoder();
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
static boolean isInstanceOf(VideoEncoder encoder) {
|
||||
return encoder instanceof WrappedNativeVideoEncoder;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user