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

Unified Diff: webrtc/api/android/jni/peerconnection_jni.cc

Issue 2291583002: Revert of Remove the old AndroidVideoCapturer stack code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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
« no previous file with comments | « webrtc/api/android/jni/classreferenceholder.cc ('k') | webrtc/api/androidvideocapturer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/jni/peerconnection_jni.cc
diff --git a/webrtc/api/android/jni/peerconnection_jni.cc b/webrtc/api/android/jni/peerconnection_jni.cc
index 0de132d65737d3a420bb1ee2e6e1ad2383949c1c..9efe037c9ff2d036976dce06c2e8029ff146a696 100644
--- a/webrtc/api/android/jni/peerconnection_jni.cc
+++ b/webrtc/api/android/jni/peerconnection_jni.cc
@@ -43,10 +43,12 @@
#include <memory>
#include <utility>
+#include "webrtc/api/androidvideocapturer.h"
#include "webrtc/api/androidvideotracksource.h"
#include "webrtc/api/android/jni/androidmediadecoder_jni.h"
#include "webrtc/api/android/jni/androidmediaencoder_jni.h"
#include "webrtc/api/android/jni/androidnetworkmonitor_jni.h"
+#include "webrtc/api/android/jni/androidvideocapturer_jni.h"
#include "webrtc/api/android/jni/classreferenceholder.h"
#include "webrtc/api/android/jni/jni_helpers.h"
#include "webrtc/api/android/jni/native_handle_impl.h"
@@ -1000,6 +1002,9 @@
RTC_DCHECK(j_application_context == nullptr);
j_application_context = NewGlobalRef(jni, context);
+ if (initialize_video) {
+ failure |= AndroidVideoCapturerJni::SetAndroidObjects(jni, context);
+ }
if (initialize_audio)
failure |= webrtc::VoiceEngine::SetAndroidObjects(GetJVM(), context);
factory_static_initialized = true;
@@ -1256,7 +1261,27 @@
return (jlong)stream.release();
}
-JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)
+JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)(
+ JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context,
+ jobject j_video_capturer, jobject j_constraints) {
+ // Create a cricket::VideoCapturer from |j_video_capturer|.
+ rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
+ new rtc::RefCountedObject<AndroidVideoCapturerJni>(
+ jni, j_video_capturer, j_egl_context);
+ std::unique_ptr<cricket::VideoCapturer> capturer(
+ new webrtc::AndroidVideoCapturer(delegate));
+ // Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer,
+ // native factory and constraints.
+ std::unique_ptr<ConstraintsWrapper> constraints(
+ new ConstraintsWrapper(jni, j_constraints));
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
+ factoryFromJava(native_factory));
+ rtc::scoped_refptr<VideoTrackSourceInterface> source(
+ factory->CreateVideoSource(capturer.release(), constraints.get()));
+ return (jlong)source.release();
+}
+
+JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource2)
(JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context) {
OwnedFactoryAndThreads* factory =
reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
« no previous file with comments | « webrtc/api/android/jni/classreferenceholder.cc ('k') | webrtc/api/androidvideocapturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698