
Previously, wrapped native codec instances would leak the native object if it was never used. This change fixes it by changing getNative method to createNative. Also fixes "Video codec hardware acceleration" setting in AppRTCMobile. Bug: webrtc:7925 Change-Id: I53f6dc1dd5e37dea8d14278423122dede17719c5 Reviewed-on: https://webrtc-review.googlesource.com/24881 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20859}
32 lines
1020 B
Java
32 lines
1020 B
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 encoder that falls back on a secondary encoder if the primary encoder fails.
|
|
*/
|
|
public class VideoEncoderFallback extends WrappedNativeVideoEncoder {
|
|
private final VideoEncoder fallback;
|
|
private final VideoEncoder primary;
|
|
|
|
public VideoEncoderFallback(VideoEncoder fallback, VideoEncoder primary) {
|
|
this.fallback = fallback;
|
|
this.primary = primary;
|
|
}
|
|
|
|
@Override
|
|
long createNativeEncoder() {
|
|
return createNativeEncoder(fallback, primary);
|
|
}
|
|
|
|
private static native long createNativeEncoder(VideoEncoder fallback, VideoEncoder primary);
|
|
}
|