Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2141)

Unified Diff: webrtc/sdk/android/src/jni/videoencoderfactorywrapper.h

Issue 3003873002: Bindings for injectable Java video encoders. (Closed)
Patch Set: Fix tests Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/sdk/android/src/jni/videoencoderfactorywrapper.h
diff --git a/webrtc/sdk/android/src/jni/videoencoderfactorywrapper.h b/webrtc/sdk/android/src/jni/videoencoderfactorywrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..03d054dbb8b467bc8a708a983f6af412002b910a
--- /dev/null
+++ b/webrtc/sdk/android/src/jni/videoencoderfactorywrapper.h
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+#ifndef WEBRTC_SDK_ANDROID_SRC_JNI_VIDEOENCODERFACTORYWRAPPER_H_
+#define WEBRTC_SDK_ANDROID_SRC_JNI_VIDEOENCODERFACTORYWRAPPER_H_
+
+#include <jni.h>
+#include <vector>
+
+#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
+#include "webrtc/sdk/android/src/jni/jni_helpers.h"
+
+namespace webrtc {
+namespace jni {
+
+// Wrapper for Java VideoEncoderFactory class. Delegates method calls through
+// JNI and wraps the encoder inside VideoEncoderWrapper.
+class VideoEncoderFactoryWrapper : public cricket::WebRtcVideoEncoderFactory {
+ public:
+ VideoEncoderFactoryWrapper(JNIEnv* jni, jobject encoder_factory);
+
+ // Caller takes the ownership of the returned object and it should be released
+ // by calling DestroyVideoEncoder().
+ VideoEncoder* CreateVideoEncoder(const cricket::VideoCodec& codec) override;
+
+ // Returns a list of supported codecs in order of preference.
+ const std::vector<cricket::VideoCodec>& supported_codecs() const override {
+ return supported_codecs_;
+ }
+
+ void DestroyVideoEncoder(VideoEncoder* encoder) override;
+
+ private:
+ std::vector<cricket::VideoCodec> GetSupportedCodecs(JNIEnv* jni) const;
+ jobject ToJavaCodecInfo(JNIEnv* jni, const cricket::VideoCodec& codec);
+
+ const ScopedGlobalRef<jclass> video_codec_info_class_;
+ const ScopedGlobalRef<jclass> hash_map_class_;
+ const ScopedGlobalRef<jobject> encoder_factory_;
+
+ jmethodID create_encoder_method_;
+ jmethodID get_supported_codecs_method_;
+
+ jmethodID video_codec_info_constructor_;
+ jfieldID payload_field_;
+ jfieldID name_field_;
+ jfieldID params_field_;
+
+ jmethodID hash_map_constructor_;
+ jmethodID put_method_;
+
+ std::vector<cricket::VideoCodec> supported_codecs_;
+};
+
+} // namespace jni
+} // namespace webrtc
+
+#endif // WEBRTC_SDK_ANDROID_SRC_JNI_VIDEOENCODERFACTORYWRAPPER_H_
« no previous file with comments | « webrtc/sdk/android/src/jni/pc/video_jni.cc ('k') | webrtc/sdk/android/src/jni/videoencoderfactorywrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698