
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}
32 lines
1.0 KiB
Java
32 lines
1.0 KiB
Java
/*
|
|
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
package org.webrtc;
|
|
|
|
/**
|
|
* A combined video decoder that falls back on a secondary decoder if the primary decoder fails.
|
|
*/
|
|
public class VideoDecoderFallback extends WrappedNativeVideoDecoder {
|
|
private final VideoDecoder fallback;
|
|
private final VideoDecoder primary;
|
|
|
|
public VideoDecoderFallback(VideoDecoder fallback, VideoDecoder primary) {
|
|
this.fallback = fallback;
|
|
this.primary = primary;
|
|
}
|
|
|
|
@Override
|
|
public long createNativeVideoDecoder() {
|
|
return nativeCreateDecoder(fallback, primary);
|
|
}
|
|
|
|
private static native long nativeCreateDecoder(VideoDecoder fallback, VideoDecoder primary);
|
|
}
|