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

Side by Side Diff: webrtc/sdk/android/src/jni/videoencoderfactorywrapper.h

Issue 3003873002: Bindings for injectable Java video encoders. (Closed)
Patch Set: Rebase Created 3 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_SDK_ANDROID_SRC_JNI_VIDEOENCODERFACTORYWRAPPER_H_
12 #define WEBRTC_SDK_ANDROID_SRC_JNI_VIDEOENCODERFACTORYWRAPPER_H_
13
14 #include <jni.h>
15 #include <vector>
16
17 #include "webrtc/media/engine/webrtcvideoencoderfactory.h"
18 #include "webrtc/sdk/android/src/jni/jni_helpers.h"
19
20 namespace webrtc_jni {
magjed_webrtc 2017/08/28 16:54:21 Nest the namespaces instead.
sakal 2017/08/29 12:59:38 Done.
21
22 // Wrapper for Java VideoEncoderFactory class. Delegates method calls through
23 // JNI and wraps the encoder inside VideoEncoderWrapper.
24 class VideoEncoderFactoryWrapper : public cricket::WebRtcVideoEncoderFactory {
25 public:
26 VideoEncoderFactoryWrapper(JNIEnv* jni, jobject encoder_factory);
27
28 // Caller takes the ownership of the returned object and it should be released
29 // by calling DestroyVideoEncoder().
30 webrtc::VideoEncoder* CreateVideoEncoder(
31 const cricket::VideoCodec& codec) override;
32
33 // Returns a list of supported codecs in order of preference.
34 const std::vector<cricket::VideoCodec>& supported_codecs() const override {
35 return supported_codecs_;
36 }
37
38 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override;
39
40 private:
41 std::vector<cricket::VideoCodec> GetSupportedCodecs(JNIEnv* jni) const;
42 jobject ToJavaCodecInfo(JNIEnv* jni, const cricket::VideoCodec& codec);
43
44 const ScopedGlobalRef<jclass> video_codec_info_class_;
45 const ScopedGlobalRef<jclass> hash_map_class_;
46 const ScopedGlobalRef<jobject> encoder_factory_;
47
48 jmethodID create_encoder_method_;
49 jmethodID get_supported_codecs_method_;
50
51 jmethodID video_codec_info_constructor_;
52 jfieldID payload_field_;
53 jfieldID name_field_;
54
55 jmethodID hash_map_constructor_;
56 jmethodID put_method_;
57
58 std::vector<cricket::VideoCodec> supported_codecs_;
59 };
60
61 } // namespace webrtc_jni
62
63 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_VIDEOENCODERFACTORYWRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698