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

Side by Side Diff: webrtc/sdk/android/src/jni/pc/video_jni.cc

Issue 3009613002: Android: Replace webrtc_jni namespace with nested jni namespace (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
1 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <jni.h> 11 #include <jni.h>
12 12
13 #include "webrtc/api/videosourceproxy.h" 13 #include "webrtc/api/videosourceproxy.h"
14 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" 14 #include "webrtc/media/engine/webrtcvideodecoderfactory.h"
15 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" 15 #include "webrtc/media/engine/webrtcvideoencoderfactory.h"
16 #include "webrtc/rtc_base/logging.h" 16 #include "webrtc/rtc_base/logging.h"
17 #include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h" 17 #include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h"
18 #include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h" 18 #include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h"
19 #include "webrtc/sdk/android/src/jni/androidvideotracksource.h" 19 #include "webrtc/sdk/android/src/jni/androidvideotracksource.h"
20 #include "webrtc/sdk/android/src/jni/classreferenceholder.h" 20 #include "webrtc/sdk/android/src/jni/classreferenceholder.h"
21 #include "webrtc/sdk/android/src/jni/pc/ownedfactoryandthreads.h" 21 #include "webrtc/sdk/android/src/jni/pc/ownedfactoryandthreads.h"
22 #include "webrtc/sdk/android/src/jni/surfacetexturehelper_jni.h" 22 #include "webrtc/sdk/android/src/jni/surfacetexturehelper_jni.h"
23 #include "webrtc/sdk/android/src/jni/videodecoderfactorywrapper.h" 23 #include "webrtc/sdk/android/src/jni/videodecoderfactorywrapper.h"
24 24
25 namespace webrtc_jni { 25 namespace webrtc {
26 namespace jni {
26 27
27 // TODO(sakal): Remove this once MediaCodecVideoDecoder/Encoder are no longer 28 // TODO(sakal): Remove this once MediaCodecVideoDecoder/Encoder are no longer
28 // used and all applications inject their own codecs. 29 // used and all applications inject their own codecs.
29 // This is semi broken if someone wants to create multiple peerconnection 30 // This is semi broken if someone wants to create multiple peerconnection
30 // factories. 31 // factories.
31 static bool use_media_codec_decoder_factory; 32 static bool use_media_codec_decoder_factory;
32 33
33 cricket::WebRtcVideoEncoderFactory* CreateVideoEncoderFactory( 34 cricket::WebRtcVideoEncoderFactory* CreateVideoEncoderFactory(
34 JNIEnv* jni, 35 JNIEnv* jni,
35 jobject j_encoder_factory) { 36 jobject j_encoder_factory) {
(...skipping 24 matching lines...) Expand all
60 JNI_FUNCTION_DECLARATION(jlong, 61 JNI_FUNCTION_DECLARATION(jlong,
61 PeerConnectionFactory_nativeCreateVideoSource, 62 PeerConnectionFactory_nativeCreateVideoSource,
62 JNIEnv* jni, 63 JNIEnv* jni,
63 jclass, 64 jclass,
64 jlong native_factory, 65 jlong native_factory,
65 jobject j_surface_texture_helper, 66 jobject j_surface_texture_helper,
66 jboolean is_screencast) { 67 jboolean is_screencast) {
67 OwnedFactoryAndThreads* factory = 68 OwnedFactoryAndThreads* factory =
68 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); 69 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
69 70
70 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source( 71 rtc::scoped_refptr<AndroidVideoTrackSource> source(
71 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>( 72 new rtc::RefCountedObject<AndroidVideoTrackSource>(
72 factory->signaling_thread(), jni, j_surface_texture_helper, 73 factory->signaling_thread(), jni, j_surface_texture_helper,
73 is_screencast)); 74 is_screencast));
74 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source = 75 rtc::scoped_refptr<VideoTrackSourceProxy> proxy_source =
75 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(), 76 VideoTrackSourceProxy::Create(factory->signaling_thread(),
76 factory->worker_thread(), source); 77 factory->worker_thread(), source);
77 78
78 return (jlong)proxy_source.release(); 79 return (jlong)proxy_source.release();
79 } 80 }
80 81
81 JNI_FUNCTION_DECLARATION(jlong, 82 JNI_FUNCTION_DECLARATION(jlong,
82 PeerConnectionFactory_nativeCreateVideoTrack, 83 PeerConnectionFactory_nativeCreateVideoTrack,
83 JNIEnv* jni, 84 JNIEnv* jni,
84 jclass, 85 jclass,
85 jlong native_factory, 86 jlong native_factory,
86 jstring id, 87 jstring id,
87 jlong native_source) { 88 jlong native_source) {
88 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 89 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
89 factoryFromJava(native_factory)); 90 factoryFromJava(native_factory));
90 rtc::scoped_refptr<webrtc::VideoTrackInterface> track( 91 rtc::scoped_refptr<VideoTrackInterface> track(factory->CreateVideoTrack(
91 factory->CreateVideoTrack( 92 JavaToStdString(jni, id),
92 JavaToStdString(jni, id), 93 reinterpret_cast<VideoTrackSourceInterface*>(native_source)));
93 reinterpret_cast<webrtc::VideoTrackSourceInterface*>(native_source)));
94 return (jlong)track.release(); 94 return (jlong)track.release();
95 } 95 }
96 96
97 JNI_FUNCTION_DECLARATION( 97 JNI_FUNCTION_DECLARATION(
98 void, 98 void,
99 PeerConnectionFactory_nativeSetVideoHwAccelerationOptions, 99 PeerConnectionFactory_nativeSetVideoHwAccelerationOptions,
100 JNIEnv* jni, 100 JNIEnv* jni,
101 jclass, 101 jclass,
102 jlong native_factory, 102 jlong native_factory,
103 jobject local_egl_context, 103 jobject local_egl_context,
(...skipping 15 matching lines...) Expand all
119 119
120 MediaCodecVideoDecoderFactory* decoder_factory = 120 MediaCodecVideoDecoderFactory* decoder_factory =
121 static_cast<MediaCodecVideoDecoderFactory*>( 121 static_cast<MediaCodecVideoDecoderFactory*>(
122 owned_factory->decoder_factory()); 122 owned_factory->decoder_factory());
123 if (use_media_codec_decoder_factory && decoder_factory) { 123 if (use_media_codec_decoder_factory && decoder_factory) {
124 LOG(LS_INFO) << "Set EGL context for HW decoding."; 124 LOG(LS_INFO) << "Set EGL context for HW decoding.";
125 decoder_factory->SetEGLContext(jni, remote_egl_context); 125 decoder_factory->SetEGLContext(jni, remote_egl_context);
126 } 126 }
127 } 127 }
128 128
129 } // namespace webrtc_jni 129 } // namespace jni
130 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/sdk/android/src/jni/pc/video_jni.h ('k') | webrtc/sdk/android/src/jni/surfacetexturehelper_jni.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698