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}
This commit is contained in:
Sami Kalliomäki
2017-11-23 14:42:21 +01:00
committed by Commit Bot
parent 2a9dbe6e7e
commit aea1d1ad3f
12 changed files with 57 additions and 58 deletions

View File

@ -14,8 +14,17 @@ 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) {
super(createNativeDecoder(fallback, primary));
this.fallback = fallback;
this.primary = primary;
}
@Override
long createNativeDecoder() {
return createNativeDecoder(fallback, primary);
}
private static native long createNativeDecoder(VideoDecoder fallback, VideoDecoder primary);