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

@ -17,14 +17,11 @@
#include "api/video_codecs/video_decoder.h"
#include "common_video/h264/h264_bitstream_parser.h"
#include "sdk/android/src/jni/jni_helpers.h"
#include "sdk/android/src/jni/videoframe.h"
namespace webrtc {
namespace jni {
// Wraps a Java decoder and delegates all calls to it. Passes
// VideoDecoderWrapperCallback to the decoder on InitDecode. Wraps the received
// frames to AndroidVideoBuffer.
// Wraps a Java decoder and delegates all calls to it.
class VideoDecoderWrapper : public VideoDecoder {
public:
VideoDecoderWrapper(JNIEnv* jni, jobject decoder);
@ -51,10 +48,11 @@ class VideoDecoderWrapper : public VideoDecoder {
const char* ImplementationName() const override;
// Wraps the frame to a AndroidVideoBuffer and passes it to the callback.
void OnDecodedFrame(JNIEnv* jni,
jobject jframe,
jobject jdecode_time_ms,
jobject jqp);
void OnDecodedFrame(JNIEnv* env,
jobject j_caller,
jobject j_frame,
jobject j_decode_time_ms,
jobject j_qp);
private:
struct FrameExtraInfo {
@ -72,8 +70,6 @@ class VideoDecoderWrapper : public VideoDecoder {
rtc::Optional<uint8_t> ParseQP(const EncodedImage& input_image);
std::string GetImplementationName(JNIEnv* jni) const;
VideoCodec codec_settings_;
int32_t number_of_cores_;
@ -86,32 +82,6 @@ class VideoDecoderWrapper : public VideoDecoder {
DecodedImageCallback* callback_;
const ScopedGlobalRef<jobject> decoder_;
const ScopedGlobalRef<jclass> encoded_image_class_;
const ScopedGlobalRef<jclass> frame_type_class_;
const ScopedGlobalRef<jclass> settings_class_;
const ScopedGlobalRef<jclass> video_frame_class_;
const ScopedGlobalRef<jclass> video_codec_status_class_;
const ScopedGlobalRef<jclass> integer_class_;
jmethodID encoded_image_constructor_;
jmethodID settings_constructor_;
jfieldID empty_frame_field_;
jfieldID video_frame_key_field_;
jfieldID video_frame_delta_field_;
jmethodID video_frame_get_timestamp_ns_method_;
jmethodID init_decode_method_;
jmethodID release_method_;
jmethodID decode_method_;
jmethodID get_prefers_late_decoding_method_;
jmethodID get_implementation_name_method_;
jmethodID get_number_method_;
jobject ConvertEncodedImageToJavaEncodedImage(JNIEnv* jni,
const EncodedImage& image);
};
} // namespace jni