Files
platform-external-webrtc/sdk/android/api/org/webrtc/VideoDecoderFallback.java
Sami Kalliomäki aea1d1ad3f Android: Fix leaking software video codec instances.
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}
2017-11-24 09:41:39 +00:00

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 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
long createNativeDecoder() {
return createNativeDecoder(fallback, primary);
}
private static native long createNativeDecoder(VideoDecoder fallback, VideoDecoder primary);
}