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
@ -453,5 +453,23 @@ std::string VideoEncoderWrapper::GetImplementationName(JNIEnv* jni) const {
|
||||
jni, Java_VideoEncoder_getImplementationName(jni, encoder_));
|
||||
}
|
||||
|
||||
std::unique_ptr<VideoEncoder> JavaToNativeVideoEncoder(
|
||||
JNIEnv* jni,
|
||||
const JavaRef<jobject>& j_encoder) {
|
||||
const jlong native_encoder =
|
||||
Java_VideoEncoder_createNativeVideoEncoder(jni, j_encoder);
|
||||
VideoEncoder* encoder;
|
||||
if (native_encoder == 0) {
|
||||
encoder = new VideoEncoderWrapper(jni, j_encoder);
|
||||
} else {
|
||||
encoder = reinterpret_cast<VideoEncoder*>(native_encoder);
|
||||
}
|
||||
return std::unique_ptr<VideoEncoder>(encoder);
|
||||
}
|
||||
|
||||
bool IsHardwareVideoEncoder(JNIEnv* jni, const JavaRef<jobject>& j_encoder) {
|
||||
return Java_VideoEncoder_isHardwareEncoder(jni, j_encoder);
|
||||
}
|
||||
|
||||
} // namespace jni
|
||||
} // namespace webrtc
|
||||
|
Reference in New Issue
Block a user