Android: Generate JNI code for VideoDecoder

Bug: webrtc:8278
Change-Id: I985fa63b0c5a9cdd0fb1817730646bcd4b30288a
Reviewed-on: https://webrtc-review.googlesource.com/24221
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20803}
This commit is contained in:
Magnus Jedvert
2017-11-20 22:33:40 +01:00
committed by Commit Bot
parent 4171afb186
commit 4eb0188cb6
16 changed files with 229 additions and 219 deletions

View File

@ -0,0 +1,34 @@
/*
* 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;
import org.webrtc.VideoDecoder;
/**
* This class contains the Java glue code for JNI generation of VideoDecoder.
*/
class VideoDecoderWrapper {
// TODO(bugs.webrtc.org/8551) Remove.
@CalledByNative
static VideoDecoder.Settings createSettings(int numberOfCores, int width, int height) {
return new VideoDecoder.Settings(numberOfCores, width, height);
}
@CalledByNative
static VideoDecoder.Callback createDecoderCallback(final long nativeDecoder) {
return (VideoFrame frame, Integer decodeTimeMs,
Integer qp) -> nativeOnDecodedFrame(nativeDecoder, frame, decodeTimeMs, qp);
}
@NativeClassQualifiedName("webrtc::jni::VideoDecoderWrapper")
private static native void nativeOnDecodedFrame(
long nativeDecoder, VideoFrame frame, Integer decodeTimeMs, Integer qp);
}

View File

@ -1,30 +0,0 @@
/*
* Copyright (c) 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;
/**
* VideoDecoder callback that calls VideoDecoderWrapper.OnDecodedFrame for the decoded frames.
*/
class VideoDecoderWrapperCallback implements VideoDecoder.Callback {
private final long nativeDecoder;
public VideoDecoderWrapperCallback(long nativeDecoder) {
this.nativeDecoder = nativeDecoder;
}
@Override
public void onDecodedFrame(VideoFrame frame, Integer decodeTimeMs, Integer qp) {
nativeOnDecodedFrame(nativeDecoder, frame, decodeTimeMs, qp);
}
private native static void nativeOnDecodedFrame(
long nativeDecoder, VideoFrame frame, Integer decodeTimeMs, Integer qp);
}

View File

@ -36,16 +36,6 @@ class VideoEncoderWrapper {
return new VideoEncoder.BitrateAllocation(bitratesBbs);
}
@CalledByNative
static EncodedImage.FrameType createFrameType(int nativeIndex) {
for (EncodedImage.FrameType type : EncodedImage.FrameType.values()) {
if (type.getNative() == nativeIndex) {
return type;
}
}
throw new IllegalArgumentException("Unknown native frame type: " + nativeIndex);
}
@CalledByNative
static boolean getScalingSettingsOn(VideoEncoder.ScalingSettings scalingSettings) {
return scalingSettings.on;