blob: 59e7ffc271ea538ab96186c071b2d01d8c215dcc [file] [log] [blame]
Anders Carlssonc3fedcc2017-11-15 14:36:33 +01001/*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11package org.webrtc;
12
13/**
14 * A combined video encoder that falls back on a secondary encoder if the primary encoder fails.
15 */
Magnus Jedvert84d8ae52017-12-20 15:12:10 +010016@JNINamespace("webrtc::jni")
Anders Carlssonc3fedcc2017-11-15 14:36:33 +010017public class VideoEncoderFallback extends WrappedNativeVideoEncoder {
Sami Kalliomäkiaea1d1a2017-11-23 14:42:21 +010018 private final VideoEncoder fallback;
19 private final VideoEncoder primary;
20
Anders Carlssonc3fedcc2017-11-15 14:36:33 +010021 public VideoEncoderFallback(VideoEncoder fallback, VideoEncoder primary) {
Sami Kalliomäkiaea1d1a2017-11-23 14:42:21 +010022 this.fallback = fallback;
23 this.primary = primary;
24 }
25
26 @Override
27 long createNativeEncoder() {
Magnus Jedvert84d8ae52017-12-20 15:12:10 +010028 return nativeCreateEncoder(fallback, primary);
Anders Carlssonc3fedcc2017-11-15 14:36:33 +010029 }
30
Sami Kalliomäki6196feb2017-11-24 11:00:04 +010031 @Override
32 boolean isSoftwareEncoder() {
33 return isWrappedSoftwareEncoder(primary);
34 }
35
Magnus Jedvert84d8ae52017-12-20 15:12:10 +010036 private static native long nativeCreateEncoder(VideoEncoder fallback, VideoEncoder primary);
Anders Carlssonc3fedcc2017-11-15 14:36:33 +010037}