Index: webrtc/sdk/android/src/jni/peerconnection_jni.cc |
diff --git a/webrtc/sdk/android/src/jni/peerconnection_jni.cc b/webrtc/sdk/android/src/jni/peerconnection_jni.cc |
index c07d58faffc6210116057b02cf9d52f3a9432ea8..59f6f6859ad60f7a17be5edbf75d9ed98f21b6d4 100644 |
--- a/webrtc/sdk/android/src/jni/peerconnection_jni.cc |
+++ b/webrtc/sdk/android/src/jni/peerconnection_jni.cc |
@@ -61,18 +61,37 @@ |
#include "webrtc/base/ssladapter.h" |
#include "webrtc/base/stringutils.h" |
#include "webrtc/media/base/videocapturer.h" |
-#include "webrtc/media/engine/webrtcvideodecoderfactory.h" |
-#include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
+ |
+// Adding 'nogncheck' to disable the gn include header check. We don't want to |
+// depend on audio and video related targets when build the datachannel only |
+// targets. |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
Taylor Brandstetter
2017/05/11 04:43:11
I won't comment for each one, but the #ifdefs in t
sakal
2017/05/11 11:06:12
Do we really need both voice and video for all of
Zhi Huang
2017/05/12 20:05:33
Not really.
Zhi Huang
2017/05/12 20:05:34
Done.
I was being lazy and just replaced all the
|
+#include "webrtc/media/engine/webrtcvideodecoderfactory.h" // nogncheck |
+#include "webrtc/media/engine/webrtcvideoencoderfactory.h" // nogncheck |
+#endif |
+ |
#include "webrtc/modules/utility/include/jvm_android.h" |
#include "webrtc/system_wrappers/include/field_trial.h" |
#include "webrtc/pc/webrtcsdp.h" |
-#include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h" |
-#include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h" |
+ |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
+#include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h" // nogncheck |
+#include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h" // nogncheck |
+#endif |
+ |
#include "webrtc/sdk/android/src/jni/androidnetworkmonitor_jni.h" |
-#include "webrtc/sdk/android/src/jni/androidvideotracksource.h" |
+ |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
+#include "webrtc/sdk/android/src/jni/androidvideotracksource.h" // nogncheck |
+#endif |
+ |
#include "webrtc/sdk/android/src/jni/classreferenceholder.h" |
#include "webrtc/sdk/android/src/jni/jni_helpers.h" |
-#include "webrtc/sdk/android/src/jni/native_handle_impl.h" |
+ |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
+#include "webrtc/sdk/android/src/jni/native_handle_impl.h" // nogncheck |
+#endif |
+ |
#include "webrtc/sdk/android/src/jni/rtcstatscollectorcallbackwrapper.h" |
// Adding 'nogncheck' to disable the gn include headers check. |
// We don't want to depend on 'system_wrappers:field_trial_default' because |
@@ -80,7 +99,7 @@ |
#include "webrtc/system_wrappers/include/field_trial_default.h" // nogncheck |
#include "webrtc/system_wrappers/include/logcat_trace_context.h" |
#include "webrtc/system_wrappers/include/trace.h" |
-#include "webrtc/voice_engine/include/voe_base.h" |
+#include "webrtc/voice_engine/include/voe_base.h" // nogncheck |
using cricket::WebRtcVideoDecoderFactory; |
using cricket::WebRtcVideoEncoderFactory; |
@@ -920,15 +939,21 @@ class JavaVideoRendererWrapper |
// Return a VideoRenderer.I420Frame referring texture object in |frame|. |
jobject CricketToJavaTextureFrame(const webrtc::VideoFrame* frame) { |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
NativeHandleImpl* handle = reinterpret_cast<NativeHandleImpl*>( |
frame->video_frame_buffer()->native_handle()); |
jfloatArray sampling_matrix = handle->sampling_matrix.ToJava(jni()); |
- |
return jni()->NewObject( |
- *j_frame_class_, j_texture_frame_ctor_id_, |
- frame->width(), frame->height(), |
- static_cast<int>(frame->rotation()), |
+ *j_frame_class_, j_texture_frame_ctor_id_, frame->width(), |
+ frame->height(), static_cast<int>(frame->rotation()), |
handle->oes_texture_id, sampling_matrix, javaShallowCopy(frame)); |
+#else |
+ jint texture_id = 0; |
+ return jni()->NewObject(*j_frame_class_, j_texture_frame_ctor_id_, |
+ frame->width(), frame->height(), |
+ static_cast<int>(frame->rotation()), texture_id, |
+ jni()->NewFloatArray(16), javaShallowCopy(frame)); |
+#endif |
} |
JNIEnv* jni() { |
@@ -1353,10 +1378,12 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnectionFactory)( |
options = ParseOptionsFromJava(jni, joptions); |
} |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
if (video_hw_acceleration_enabled) { |
encoder_factory = new MediaCodecVideoEncoderFactory(); |
decoder_factory = new MediaCodecVideoDecoderFactory(); |
} |
+#endif |
// Do not create network_monitor_factory only if the options are |
// provided and disable_network_monitor therein is set to true. |
if (!(has_options && options.disable_network_monitor)) { |
@@ -1416,6 +1443,7 @@ JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)( |
JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource) |
(JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context, |
jboolean is_screencast) { |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
OwnedFactoryAndThreads* factory = |
reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); |
@@ -1427,6 +1455,9 @@ JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource) |
factory->worker_thread(), source); |
return (jlong)proxy_source.release(); |
+#else |
+ return (jlong)0; |
+#endif |
} |
JOW(void, PeerConnectionFactory_nativeInitializeVideoCapturer) |
@@ -1436,6 +1467,7 @@ JOW(void, PeerConnectionFactory_nativeInitializeVideoCapturer) |
jobject j_video_capturer, |
jlong native_source, |
jobject j_frame_observer) { |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
LOG(LS_INFO) << "PeerConnectionFactory_nativeInitializeVideoCapturer"; |
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
factoryFromJava(native_factory)); |
@@ -1455,6 +1487,7 @@ JOW(void, PeerConnectionFactory_nativeInitializeVideoCapturer) |
: nullptr, |
j_application_context, j_frame_observer); |
CHECK_EXCEPTION(jni) << "error during VideoCapturer.initialize()"; |
+#endif |
} |
JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)( |
@@ -1529,6 +1562,7 @@ JOW(void, PeerConnectionFactory_nativeSetOptions)( |
JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( |
JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context, |
jobject remote_egl_context) { |
+#if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) |
OwnedFactoryAndThreads* owned_factory = |
reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); |
@@ -1551,6 +1585,7 @@ JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( |
LOG(LS_INFO) << "Set EGL context for HW decoding."; |
decoder_factory->SetEGLContext(jni, remote_egl_context); |
} |
+#endif |
} |
static PeerConnectionInterface::IceTransportsType |