Remove Java PC support.
This cl removes none Android Java support. Review URL: https://codereview.webrtc.org/1652123002 Cr-Commit-Position: refs/heads/master@{#11522}
This commit is contained in:
3
DEPS
3
DEPS
@ -16,9 +16,6 @@ deps = {
|
||||
# https://chromium.googlesource.com/chromium/deps/webrtc/webrtc.DEPS
|
||||
'src/third_party/gflags/src':
|
||||
Var('chromium_git') + '/external/gflags/src@e7390f9185c75f8d902c05ed7d20bb94eb914d0c', # from svn revision 82
|
||||
|
||||
'src/third_party/junit-jar':
|
||||
Var('chromium_git') + '/external/webrtc/deps/third_party/junit@f35596b476aa6e62fd3b3857b9942ddcd13ce35e', # from svn revision 3367
|
||||
}
|
||||
|
||||
deps_os = {
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.webrtc;
|
||||
|
||||
import android.test.ActivityTestCase;
|
||||
|
||||
public class PeerConnectionAndroidTest extends ActivityTestCase {
|
||||
private PeerConnectionTest test = new PeerConnectionTest();
|
||||
|
||||
@Override
|
||||
protected void setUp() {
|
||||
assertTrue(PeerConnectionFactory.initializeAndroidGlobals(
|
||||
getInstrumentation().getContext(), true, true, true));
|
||||
}
|
||||
|
||||
public void testCompleteSession() throws Exception {
|
||||
// TODO(perkj): Investigate if |test.initializeThreadCheck()| can be used
|
||||
// on android as well. Currently this check fail.
|
||||
test.doTest();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -31,6 +31,8 @@ import org.webrtc.PeerConnection.IceConnectionState;
|
||||
import org.webrtc.PeerConnection.IceGatheringState;
|
||||
import org.webrtc.PeerConnection.SignalingState;
|
||||
|
||||
import android.test.suitebuilder.annotation.MediumTest;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -44,15 +46,19 @@ import java.util.TreeSet;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
|
||||
/** End-to-end tests for PeerConnection.java. */
|
||||
public class PeerConnectionTest {
|
||||
// Set to true to render video.
|
||||
private static final boolean RENDER_TO_GUI = false;
|
||||
import android.test.ActivityTestCase;
|
||||
|
||||
public class PeerConnectionTest extends ActivityTestCase {
|
||||
private static final int TIMEOUT_SECONDS = 20;
|
||||
private TreeSet<String> threadsBeforeTest = null;
|
||||
|
||||
@Override
|
||||
protected void setUp() {
|
||||
assertTrue(PeerConnectionFactory.initializeAndroidGlobals(
|
||||
getInstrumentation().getContext(), true, true, true));
|
||||
}
|
||||
|
||||
private static class ObserverExpectations implements PeerConnection.Observer,
|
||||
VideoRenderer.Callbacks,
|
||||
DataChannel.Observer,
|
||||
@ -118,7 +124,6 @@ public class PeerConnectionTest {
|
||||
}
|
||||
|
||||
private synchronized void setSize(int width, int height) {
|
||||
assertFalse(RENDER_TO_GUI);
|
||||
// Because different camera devices (fake & physical) produce different
|
||||
// resolutions, we only sanity-check the set sizes,
|
||||
assertTrue(width > 0);
|
||||
@ -133,7 +138,6 @@ public class PeerConnectionTest {
|
||||
}
|
||||
|
||||
public synchronized void expectFramesDelivered(int count) {
|
||||
assertFalse(RENDER_TO_GUI);
|
||||
expectedFramesDelivered += count;
|
||||
}
|
||||
|
||||
@ -458,14 +462,7 @@ public class PeerConnectionTest {
|
||||
|
||||
private static VideoRenderer createVideoRenderer(
|
||||
VideoRenderer.Callbacks videoCallbacks) {
|
||||
if (!RENDER_TO_GUI) {
|
||||
return new VideoRenderer(videoCallbacks);
|
||||
}
|
||||
++videoWindowsMapped;
|
||||
assertTrue(videoWindowsMapped < 4);
|
||||
int x = videoWindowsMapped % 2 != 0 ? 700 : 0;
|
||||
int y = videoWindowsMapped >= 2 ? 0 : 500;
|
||||
return VideoRenderer.createGui(x, y);
|
||||
return new VideoRenderer(videoCallbacks);
|
||||
}
|
||||
|
||||
// Return a weak reference to test that ownership is correctly held by
|
||||
@ -516,7 +513,8 @@ public class PeerConnectionTest {
|
||||
// Thread.sleep(100);
|
||||
}
|
||||
|
||||
void doTest() throws Exception {
|
||||
@MediumTest
|
||||
public void testCompleteSession() throws Exception {
|
||||
// Allow loopback interfaces too since our Android devices often don't
|
||||
// have those.
|
||||
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
|
||||
@ -554,7 +552,7 @@ public class PeerConnectionTest {
|
||||
// We want to use the same camera for offerer & answerer, so create it here
|
||||
// instead of in addTracksToPC.
|
||||
VideoSource videoSource = factory.createVideoSource(
|
||||
VideoCapturer.create(""), new MediaConstraints());
|
||||
VideoCapturerAndroid.create("", null), new MediaConstraints());
|
||||
|
||||
offeringExpectations.expectRenegotiationNeeded();
|
||||
WeakReference<MediaStream> oLMS = addTracksToPC(
|
||||
@ -648,12 +646,11 @@ public class PeerConnectionTest {
|
||||
assertEquals(answeringPC.getSenders().size(), 2);
|
||||
assertEquals(answeringPC.getReceivers().size(), 2);
|
||||
|
||||
if (!RENDER_TO_GUI) {
|
||||
// Wait for at least some frames to be delivered at each end (number
|
||||
// chosen arbitrarily).
|
||||
offeringExpectations.expectFramesDelivered(10);
|
||||
answeringExpectations.expectFramesDelivered(10);
|
||||
}
|
||||
|
||||
// Wait for at least some frames to be delivered at each end (number
|
||||
// chosen arbitrarily).
|
||||
offeringExpectations.expectFramesDelivered(10);
|
||||
answeringExpectations.expectFramesDelivered(10);
|
||||
|
||||
offeringExpectations.expectStateChange(DataChannel.State.OPEN);
|
||||
// See commentary about SCTP DataChannels above for why this is here.
|
||||
@ -708,14 +705,6 @@ public class PeerConnectionTest {
|
||||
answeringExpectations.dataChannel.close();
|
||||
offeringExpectations.dataChannel.close();
|
||||
|
||||
if (RENDER_TO_GUI) {
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(fischman) MOAR test ideas:
|
||||
// - Test that PC.removeStream() works; requires a second
|
||||
// createOffer/createAnswer dance.
|
||||
@ -2,22 +2,9 @@ This directory holds a Java implementation of the webrtc::PeerConnection API, as
|
||||
well as the JNI glue C++ code that lets the Java implementation reuse the C++
|
||||
implementation of the same API.
|
||||
|
||||
To build the Java API and related tests, build with
|
||||
OS=linux or OS=android and include
|
||||
build_with_libjingle=1 build_with_chromium=0
|
||||
in $GYP_DEFINES.
|
||||
To build the Java API and related tests, build with OS=android in $GYP_DEFINES.
|
||||
|
||||
To use the Java API, start by looking at the public interface of
|
||||
org.webrtc.PeerConnection{,Factory} and the org.webrtc.PeerConnectionTest.
|
||||
|
||||
To understand the implementation of the API, see the native code in jni/.
|
||||
|
||||
An example command-line to build & run the unittest:
|
||||
cd path/to/trunk
|
||||
GYP_DEFINES="build_with_libjingle=1 build_with_chromium=0 java_home=path/to/JDK" gclient runhooks && \
|
||||
ninja -C out/Debug libjingle_peerconnection_java_unittest && \
|
||||
./out/Debug/libjingle_peerconnection_java_unittest
|
||||
(where path/to/JDK should contain include/jni.h)
|
||||
|
||||
During development it can be helpful to run the JVM with the -Xcheck:jni flag.
|
||||
|
||||
|
||||
@ -62,28 +62,21 @@ void FreeGlobalClassReferenceHolder() {
|
||||
}
|
||||
|
||||
ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni) {
|
||||
LoadClass(jni, "android/graphics/SurfaceTexture");
|
||||
LoadClass(jni, "java/nio/ByteBuffer");
|
||||
LoadClass(jni, "java/util/ArrayList");
|
||||
LoadClass(jni, "org/webrtc/AudioTrack");
|
||||
LoadClass(jni, "org/webrtc/CameraEnumerator");
|
||||
LoadClass(jni, "org/webrtc/Camera2Enumerator");
|
||||
LoadClass(jni, "org/webrtc/CameraEnumerationAndroid");
|
||||
LoadClass(jni, "org/webrtc/DataChannel");
|
||||
LoadClass(jni, "org/webrtc/DataChannel$Buffer");
|
||||
LoadClass(jni, "org/webrtc/DataChannel$Init");
|
||||
LoadClass(jni, "org/webrtc/DataChannel$State");
|
||||
LoadClass(jni, "org/webrtc/IceCandidate");
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
LoadClass(jni, "android/graphics/SurfaceTexture");
|
||||
LoadClass(jni, "org/webrtc/CameraEnumerator");
|
||||
LoadClass(jni, "org/webrtc/Camera2Enumerator");
|
||||
LoadClass(jni, "org/webrtc/CameraEnumerationAndroid");
|
||||
LoadClass(jni, "org/webrtc/VideoCapturerAndroid");
|
||||
LoadClass(jni, "org/webrtc/VideoCapturerAndroid$NativeObserver");
|
||||
LoadClass(jni, "org/webrtc/EglBase");
|
||||
LoadClass(jni, "org/webrtc/EglBase$Context");
|
||||
LoadClass(jni, "org/webrtc/EglBase14$Context");
|
||||
LoadClass(jni, "org/webrtc/NetworkMonitor");
|
||||
LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$ConnectionType");
|
||||
LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$IPAddress");
|
||||
LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$NetworkInformation");
|
||||
LoadClass(jni, "org/webrtc/IceCandidate");
|
||||
LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder");
|
||||
LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder$OutputBufferInfo");
|
||||
LoadClass(jni, "org/webrtc/MediaCodecVideoEncoder$VideoCodecType");
|
||||
@ -91,11 +84,13 @@ ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni) {
|
||||
LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$DecodedTextureBuffer");
|
||||
LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$DecodedOutputBuffer");
|
||||
LoadClass(jni, "org/webrtc/MediaCodecVideoDecoder$VideoCodecType");
|
||||
LoadClass(jni, "org/webrtc/SurfaceTextureHelper");
|
||||
#endif
|
||||
LoadClass(jni, "org/webrtc/MediaSource$State");
|
||||
LoadClass(jni, "org/webrtc/MediaStream");
|
||||
LoadClass(jni, "org/webrtc/MediaStreamTrack$State");
|
||||
LoadClass(jni, "org/webrtc/NetworkMonitor");
|
||||
LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$ConnectionType");
|
||||
LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$IPAddress");
|
||||
LoadClass(jni, "org/webrtc/NetworkMonitorAutoDetect$NetworkInformation");
|
||||
LoadClass(jni, "org/webrtc/PeerConnectionFactory");
|
||||
LoadClass(jni, "org/webrtc/PeerConnection$BundlePolicy");
|
||||
LoadClass(jni, "org/webrtc/PeerConnection$ContinualGatheringPolicy");
|
||||
@ -112,8 +107,10 @@ ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni) {
|
||||
LoadClass(jni, "org/webrtc/SessionDescription$Type");
|
||||
LoadClass(jni, "org/webrtc/StatsReport");
|
||||
LoadClass(jni, "org/webrtc/StatsReport$Value");
|
||||
LoadClass(jni, "org/webrtc/SurfaceTextureHelper");
|
||||
LoadClass(jni, "org/webrtc/VideoCapturerAndroid");
|
||||
LoadClass(jni, "org/webrtc/VideoCapturerAndroid$NativeObserver");
|
||||
LoadClass(jni, "org/webrtc/VideoRenderer$I420Frame");
|
||||
LoadClass(jni, "org/webrtc/VideoCapturer");
|
||||
LoadClass(jni, "org/webrtc/VideoTrack");
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,12 @@
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "talk/app/webrtc/androidvideocapturer.h"
|
||||
#include "talk/app/webrtc/dtlsidentitystore.h"
|
||||
#include "talk/app/webrtc/java/jni/androidmediadecoder_jni.h"
|
||||
#include "talk/app/webrtc/java/jni/androidmediaencoder_jni.h"
|
||||
#include "talk/app/webrtc/java/jni/androidvideocapturer_jni.h"
|
||||
#include "talk/app/webrtc/java/jni/androidnetworkmonitor_jni.h"
|
||||
#include "talk/app/webrtc/java/jni/classreferenceholder.h"
|
||||
#include "talk/app/webrtc/java/jni/jni_helpers.h"
|
||||
#include "talk/app/webrtc/java/jni/native_handle_impl.h"
|
||||
@ -83,20 +88,10 @@
|
||||
#include "webrtc/media/webrtc/webrtcvideodecoderfactory.h"
|
||||
#include "webrtc/media/webrtc/webrtcvideoencoderfactory.h"
|
||||
#include "webrtc/system_wrappers/include/field_trial_default.h"
|
||||
#include "webrtc/system_wrappers/include/logcat_trace_context.h"
|
||||
#include "webrtc/system_wrappers/include/trace.h"
|
||||
#include "webrtc/voice_engine/include/voe_base.h"
|
||||
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
#include "talk/app/webrtc/androidvideocapturer.h"
|
||||
#include "talk/app/webrtc/java/jni/androidmediadecoder_jni.h"
|
||||
#include "talk/app/webrtc/java/jni/androidmediaencoder_jni.h"
|
||||
#include "talk/app/webrtc/java/jni/androidnetworkmonitor_jni.h"
|
||||
#include "talk/app/webrtc/java/jni/androidvideocapturer_jni.h"
|
||||
#include "webrtc/modules/video_render/video_render_internal.h"
|
||||
#include "webrtc/system_wrappers/include/logcat_trace_context.h"
|
||||
using webrtc::LogcatTraceContext;
|
||||
#endif
|
||||
|
||||
using cricket::WebRtcVideoDecoderFactory;
|
||||
using cricket::WebRtcVideoEncoderFactory;
|
||||
using rtc::Bind;
|
||||
@ -112,6 +107,7 @@ using webrtc::DataChannelInit;
|
||||
using webrtc::DataChannelInterface;
|
||||
using webrtc::DataChannelObserver;
|
||||
using webrtc::IceCandidateInterface;
|
||||
using webrtc::LogcatTraceContext;
|
||||
using webrtc::MediaConstraintsInterface;
|
||||
using webrtc::MediaSourceInterface;
|
||||
using webrtc::MediaStreamInterface;
|
||||
@ -137,11 +133,9 @@ namespace webrtc_jni {
|
||||
// Field trials initialization string
|
||||
static char *field_trials_init_string = NULL;
|
||||
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
// Set in PeerConnectionFactory_initializeAndroidGlobals().
|
||||
static bool factory_static_initialized = false;
|
||||
static bool video_hw_acceleration_enabled = true;
|
||||
#endif
|
||||
|
||||
// Return the (singleton) Java Enum object corresponding to |index|;
|
||||
// |state_class_fragment| is something like "MediaSource$State".
|
||||
@ -889,18 +883,14 @@ JOW(void, Logging_nativeEnableTracing)(
|
||||
std::string path = JavaToStdString(jni, j_path);
|
||||
if (nativeLevels != webrtc::kTraceNone) {
|
||||
webrtc::Trace::set_level_filter(nativeLevels);
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
if (path != "logcat:") {
|
||||
#endif
|
||||
RTC_CHECK_EQ(0, webrtc::Trace::SetTraceFile(path.c_str(), false))
|
||||
<< "SetTraceFile failed";
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
} else {
|
||||
// Intentionally leak this to avoid needing to reason about its lifecycle.
|
||||
// It keeps no state and functions only as a dispatch point.
|
||||
static LogcatTraceContext* g_trace_callback = new LogcatTraceContext();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (nativeSeverity >= rtc::LS_SENSITIVE && nativeSeverity <= rtc::LS_ERROR) {
|
||||
rtc::LogMessage::LogToDebug(
|
||||
@ -940,10 +930,6 @@ JOW(void, VideoCapturer_free)(JNIEnv*, jclass, jlong j_p) {
|
||||
delete reinterpret_cast<cricket::VideoCapturer*>(j_p);
|
||||
}
|
||||
|
||||
JOW(void, VideoRenderer_freeGuiVideoRenderer)(JNIEnv*, jclass, jlong j_p) {
|
||||
delete reinterpret_cast<VideoRendererWrapper*>(j_p);
|
||||
}
|
||||
|
||||
JOW(void, VideoRenderer_freeWrappedVideoRenderer)(JNIEnv*, jclass, jlong j_p) {
|
||||
delete reinterpret_cast<JavaVideoRendererWrapper*>(j_p);
|
||||
}
|
||||
@ -995,7 +981,6 @@ JOW(jlong, PeerConnectionFactory_nativeCreateObserver)(
|
||||
return (jlong)new PCOJava(jni, j_observer);
|
||||
}
|
||||
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
JOW(jboolean, PeerConnectionFactory_initializeAndroidGlobals)(
|
||||
JNIEnv* jni, jclass, jobject context,
|
||||
jboolean initialize_audio, jboolean initialize_video,
|
||||
@ -1005,7 +990,6 @@ JOW(jboolean, PeerConnectionFactory_initializeAndroidGlobals)(
|
||||
AndroidNetworkMonitor::SetAndroidContext(jni, context);
|
||||
if (!factory_static_initialized) {
|
||||
if (initialize_video) {
|
||||
failure |= webrtc::SetRenderAndroidVM(GetJVM());
|
||||
failure |= AndroidVideoCapturerJni::SetAndroidObjects(jni, context);
|
||||
}
|
||||
if (initialize_audio)
|
||||
@ -1014,7 +998,6 @@ JOW(jboolean, PeerConnectionFactory_initializeAndroidGlobals)(
|
||||
}
|
||||
return !failure;
|
||||
}
|
||||
#endif // defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
|
||||
JOW(void, PeerConnectionFactory_initializeFieldTrials)(
|
||||
JNIEnv* jni, jclass, jstring j_trials_init_string) {
|
||||
@ -1185,7 +1168,7 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnectionFactory)(
|
||||
if (has_options) {
|
||||
options = ParseOptionsFromJava(jni, joptions);
|
||||
}
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
|
||||
if (video_hw_acceleration_enabled) {
|
||||
encoder_factory = new MediaCodecVideoEncoderFactory();
|
||||
decoder_factory = new MediaCodecVideoDecoderFactory();
|
||||
@ -1196,7 +1179,7 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnectionFactory)(
|
||||
network_monitor_factory = new AndroidNetworkMonitorFactory();
|
||||
rtc::NetworkMonitorFactory::SetFactory(network_monitor_factory);
|
||||
}
|
||||
#endif
|
||||
|
||||
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
|
||||
webrtc::CreatePeerConnectionFactory(worker_thread,
|
||||
signaling_thread,
|
||||
@ -1299,42 +1282,30 @@ JOW(jlong, PeerConnectionFactory_nativeCreateAudioTrack)(
|
||||
JOW(jboolean, PeerConnectionFactory_nativeStartAecDump)(
|
||||
JNIEnv* jni, jclass, jlong native_factory, jint file,
|
||||
jint filesize_limit_bytes) {
|
||||
#if defined(ANDROID)
|
||||
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
|
||||
factoryFromJava(native_factory));
|
||||
return factory->StartAecDump(file, filesize_limit_bytes);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
JOW(void, PeerConnectionFactory_nativeStopAecDump)(
|
||||
JNIEnv* jni, jclass, jlong native_factory) {
|
||||
#if defined(ANDROID)
|
||||
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
|
||||
factoryFromJava(native_factory));
|
||||
factory->StopAecDump();
|
||||
#endif
|
||||
}
|
||||
|
||||
JOW(jboolean, PeerConnectionFactory_nativeStartRtcEventLog)(
|
||||
JNIEnv* jni, jclass, jlong native_factory, jint file) {
|
||||
#if defined(ANDROID)
|
||||
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
|
||||
factoryFromJava(native_factory));
|
||||
return factory->StartRtcEventLog(file);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
JOW(void, PeerConnectionFactory_nativeStopRtcEventLog)(
|
||||
JNIEnv* jni, jclass, jlong native_factory) {
|
||||
#if defined(ANDROID)
|
||||
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
|
||||
factoryFromJava(native_factory));
|
||||
factory->StopRtcEventLog();
|
||||
#endif
|
||||
}
|
||||
|
||||
JOW(void, PeerConnectionFactory_nativeSetOptions)(
|
||||
@ -1359,7 +1330,6 @@ JOW(void, PeerConnectionFactory_nativeSetOptions)(
|
||||
JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)(
|
||||
JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context,
|
||||
jobject remote_egl_context) {
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
OwnedFactoryAndThreads* owned_factory =
|
||||
reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
|
||||
|
||||
@ -1383,7 +1353,6 @@ JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)(
|
||||
LOG(LS_INFO) << "Set EGL context for HW decoding.";
|
||||
decoder_factory->SetEGLContext(jni, remote_egl_context);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static PeerConnectionInterface::IceTransportsType
|
||||
@ -1893,75 +1862,6 @@ JOW(jobject, MediaSource_nativeState)(JNIEnv* jni, jclass, jlong j_p) {
|
||||
return JavaEnumFromIndex(jni, "MediaSource$State", p->state());
|
||||
}
|
||||
|
||||
JOW(jobject, VideoCapturer_nativeCreateVideoCapturer)(
|
||||
JNIEnv* jni, jclass, jstring j_device_name) {
|
||||
// Since we can't create platform specific java implementations in Java, we
|
||||
// defer the creation to C land.
|
||||
#if defined(ANDROID)
|
||||
// TODO(nisse): This case is intended to be deleted.
|
||||
jclass j_video_capturer_class(
|
||||
FindClass(jni, "org/webrtc/VideoCapturerAndroid"));
|
||||
const int camera_id = jni->CallStaticIntMethod(
|
||||
j_video_capturer_class,
|
||||
GetStaticMethodID(jni, j_video_capturer_class, "lookupDeviceName",
|
||||
"(Ljava/lang/String;)I"),
|
||||
j_device_name);
|
||||
CHECK_EXCEPTION(jni) << "error during VideoCapturerAndroid.lookupDeviceName";
|
||||
if (camera_id == -1)
|
||||
return nullptr;
|
||||
jobject j_video_capturer = jni->NewObject(
|
||||
j_video_capturer_class,
|
||||
GetMethodID(jni, j_video_capturer_class, "<init>", "(I)V"), camera_id);
|
||||
CHECK_EXCEPTION(jni) << "error during creation of VideoCapturerAndroid";
|
||||
jfieldID helper_fid = GetFieldID(jni, j_video_capturer_class, "surfaceHelper",
|
||||
"Lorg/webrtc/SurfaceTextureHelper;");
|
||||
|
||||
rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
|
||||
new rtc::RefCountedObject<AndroidVideoCapturerJni>(
|
||||
jni, j_video_capturer,
|
||||
GetObjectField(jni, j_video_capturer, helper_fid));
|
||||
rtc::scoped_ptr<cricket::VideoCapturer> capturer(
|
||||
new webrtc::AndroidVideoCapturer(delegate));
|
||||
|
||||
#else
|
||||
std::string device_name = JavaToStdString(jni, j_device_name);
|
||||
scoped_ptr<cricket::DeviceManagerInterface> device_manager(
|
||||
cricket::DeviceManagerFactory::Create());
|
||||
RTC_CHECK(device_manager->Init()) << "DeviceManager::Init() failed";
|
||||
cricket::Device device;
|
||||
if (!device_manager->GetVideoCaptureDevice(device_name, &device)) {
|
||||
LOG(LS_ERROR) << "GetVideoCaptureDevice failed for " << device_name;
|
||||
return 0;
|
||||
}
|
||||
scoped_ptr<cricket::VideoCapturer> capturer(
|
||||
device_manager->CreateVideoCapturer(device));
|
||||
|
||||
jclass j_video_capturer_class(
|
||||
FindClass(jni, "org/webrtc/VideoCapturer"));
|
||||
const jmethodID j_videocapturer_ctor(GetMethodID(
|
||||
jni, j_video_capturer_class, "<init>", "()V"));
|
||||
jobject j_video_capturer =
|
||||
jni->NewObject(j_video_capturer_class,
|
||||
j_videocapturer_ctor);
|
||||
CHECK_EXCEPTION(jni) << "error during creation of VideoCapturer";
|
||||
|
||||
#endif
|
||||
const jmethodID j_videocapturer_set_native_capturer(GetMethodID(
|
||||
jni, j_video_capturer_class, "setNativeCapturer", "(J)V"));
|
||||
jni->CallVoidMethod(j_video_capturer,
|
||||
j_videocapturer_set_native_capturer,
|
||||
jlongFromPointer(capturer.release()));
|
||||
CHECK_EXCEPTION(jni) << "error during setNativeCapturer";
|
||||
return j_video_capturer;
|
||||
}
|
||||
|
||||
JOW(jlong, VideoRenderer_nativeCreateGuiVideoRenderer)(
|
||||
JNIEnv* jni, jclass, int x, int y) {
|
||||
scoped_ptr<VideoRendererWrapper> renderer(VideoRendererWrapper::Create(
|
||||
cricket::VideoRendererFactory::CreateGuiVideoRenderer(x, y)));
|
||||
return (jlong)renderer.release();
|
||||
}
|
||||
|
||||
JOW(jlong, VideoRenderer_nativeWrapVideoRenderer)(
|
||||
JNIEnv* jni, jclass, jobject j_callbacks) {
|
||||
scoped_ptr<JavaVideoRendererWrapper> renderer(
|
||||
|
||||
@ -28,19 +28,13 @@
|
||||
package org.webrtc;
|
||||
|
||||
/** Java version of cricket::VideoCapturer. */
|
||||
// TODO(perkj): Merge VideoCapturer and VideoCapturerAndroid.
|
||||
public class VideoCapturer {
|
||||
private long nativeVideoCapturer;
|
||||
|
||||
protected VideoCapturer() {
|
||||
}
|
||||
|
||||
public static VideoCapturer create(String deviceName) {
|
||||
Object capturer = nativeCreateVideoCapturer(deviceName);
|
||||
if (capturer != null)
|
||||
return (VideoCapturer) (capturer);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Sets |nativeCapturer| to be owned by VideoCapturer.
|
||||
protected void setNativeCapturer(long nativeCapturer) {
|
||||
this.nativeVideoCapturer = nativeCapturer;
|
||||
@ -64,7 +58,5 @@ public class VideoCapturer {
|
||||
}
|
||||
}
|
||||
|
||||
private static native Object nativeCreateVideoCapturer(String deviceName);
|
||||
|
||||
private static native void free(long nativeVideoCapturer);
|
||||
}
|
||||
|
||||
@ -144,27 +144,14 @@ public class VideoRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
// |this| either wraps a native (GUI) renderer or a client-supplied Callbacks
|
||||
// (Java) implementation; this is indicated by |isWrappedVideoRenderer|.
|
||||
long nativeVideoRenderer;
|
||||
private final boolean isWrappedVideoRenderer;
|
||||
|
||||
public static VideoRenderer createGui(int x, int y) {
|
||||
long nativeVideoRenderer = nativeCreateGuiVideoRenderer(x, y);
|
||||
if (nativeVideoRenderer == 0) {
|
||||
return null;
|
||||
}
|
||||
return new VideoRenderer(nativeVideoRenderer);
|
||||
}
|
||||
|
||||
public VideoRenderer(Callbacks callbacks) {
|
||||
nativeVideoRenderer = nativeWrapVideoRenderer(callbacks);
|
||||
isWrappedVideoRenderer = true;
|
||||
}
|
||||
|
||||
private VideoRenderer(long nativeVideoRenderer) {
|
||||
this.nativeVideoRenderer = nativeVideoRenderer;
|
||||
isWrappedVideoRenderer = false;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
@ -172,19 +159,12 @@ public class VideoRenderer {
|
||||
// Already disposed.
|
||||
return;
|
||||
}
|
||||
if (!isWrappedVideoRenderer) {
|
||||
freeGuiVideoRenderer(nativeVideoRenderer);
|
||||
} else {
|
||||
freeWrappedVideoRenderer(nativeVideoRenderer);
|
||||
}
|
||||
|
||||
freeWrappedVideoRenderer(nativeVideoRenderer);
|
||||
nativeVideoRenderer = 0;
|
||||
}
|
||||
|
||||
private static native long nativeCreateGuiVideoRenderer(int x, int y);
|
||||
private static native long nativeWrapVideoRenderer(Callbacks callbacks);
|
||||
|
||||
private static native void freeGuiVideoRenderer(long nativeVideoRenderer);
|
||||
private static native void freeWrappedVideoRenderer(long nativeVideoRenderer);
|
||||
|
||||
private static native void releaseNativeFrame(long nativeFramePointer);
|
||||
}
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# libjingle
|
||||
# Copyright 2013 Google Inc.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Wrapper script for running the Java tests under this directory. This script
|
||||
# will only work if it has been massaged by the build action and placed in
|
||||
# the PRODUCT_DIR (e.g. out/Debug).
|
||||
|
||||
# Exit with error immediately if any subcommand fails.
|
||||
set -e
|
||||
|
||||
# Change directory to the PRODUCT_DIR (e.g. out/Debug).
|
||||
cd -P $(dirname $0)
|
||||
|
||||
if [ -z "$LD_PRELOAD" ]; then
|
||||
echo "LD_PRELOAD isn't set. It should be set to something like "
|
||||
echo "/usr/lib/x86_64-linux-gnu/libpulse.so.0. I will now refuse to run "
|
||||
echo "to protect you from the consequences of your folly."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export CLASSPATH=`pwd`/junit-4.11.jar
|
||||
CLASSPATH=$CLASSPATH:`pwd`/libjingle_peerconnection_test.jar
|
||||
CLASSPATH=$CLASSPATH:`pwd`/libjingle_peerconnection.jar
|
||||
|
||||
# This sets java.library.path so lookup of libjingle_peerconnection_so.so works.
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`:`pwd`/lib:`pwd`/lib.target
|
||||
|
||||
# The RHS value is replaced by the build action that copies this script to
|
||||
# <(PRODUCT_DIR), using search-and-replace by the build action.
|
||||
export JAVA_HOME=GYP_JAVA_HOME
|
||||
|
||||
${JAVA_HOME}/bin/java -Xcheck:jni -classpath $CLASSPATH \
|
||||
junit.textui.TestRunner org.webrtc.PeerConnectionTestJava
|
||||
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.webrtc;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
/** End-to-end tests for PeerConnection.java. */
|
||||
public class PeerConnectionTestJava extends TestCase {
|
||||
private PeerConnectionTest test = new PeerConnectionTest();
|
||||
@Test
|
||||
public void testCompleteSession() throws Exception {
|
||||
test.initializeThreadCheck();
|
||||
test.doTest();
|
||||
test.finalizeThreadCheck();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompleteSessionOnNonMainThread() throws Exception {
|
||||
final Exception[] exceptionHolder = new Exception[1];
|
||||
Thread nonMainThread = new Thread("PeerConnectionTest-nonMainThread") {
|
||||
@Override public void run() {
|
||||
try {
|
||||
test.initializeThreadCheck();
|
||||
test.doTest();
|
||||
test.finalizeThreadCheck();
|
||||
} catch (Exception e) {
|
||||
exceptionHolder[0] = e;
|
||||
}
|
||||
}
|
||||
};
|
||||
nonMainThread.start();
|
||||
nonMainThread.join();
|
||||
if (exceptionHolder[0] != null)
|
||||
throw exceptionHolder[0];
|
||||
}
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# libjingle
|
||||
# Copyright 2013 Google Inc.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# javac & jar wrapper helping to simplify gyp action specification.
|
||||
|
||||
set -e # Exit on any error.
|
||||
|
||||
# Allow build-error parsers (such as emacs' compilation-mode) to find failing
|
||||
# files easily.
|
||||
echo "$0: Entering directory \``pwd`'"
|
||||
|
||||
JAVA_HOME="$1"; shift
|
||||
JAR_NAME="$1"; shift
|
||||
TMP_DIR="$1"; shift
|
||||
CLASSPATH="$1"; shift
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 jar-name temp-work-dir source-path-dir .so-to-bundle " \
|
||||
"classpath path/to/Source1.java path/to/Source2.java ..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$TMP_DIR"
|
||||
mkdir -p "$TMP_DIR"
|
||||
|
||||
$JAVA_HOME/bin/javac -Xlint:deprecation -Xlint:unchecked -d "$TMP_DIR" \
|
||||
-classpath "$CLASSPATH" "$@"
|
||||
$JAVA_HOME/bin/jar cf "$JAR_NAME" -C "$TMP_DIR" .
|
||||
@ -40,7 +40,7 @@
|
||||
}],
|
||||
],
|
||||
}],
|
||||
['OS=="linux" or OS=="android"', {
|
||||
['OS=="android"', {
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'libjingle_peerconnection_jni',
|
||||
@ -50,24 +50,33 @@
|
||||
'libjingle_peerconnection',
|
||||
],
|
||||
'sources': [
|
||||
'app/webrtc/androidvideocapturer.cc',
|
||||
'app/webrtc/androidvideocapturer.h',
|
||||
'app/webrtc/java/jni/androidmediacodeccommon.h',
|
||||
'app/webrtc/java/jni/androidmediadecoder_jni.cc',
|
||||
'app/webrtc/java/jni/androidmediadecoder_jni.h',
|
||||
'app/webrtc/java/jni/androidmediaencoder_jni.cc',
|
||||
'app/webrtc/java/jni/androidmediaencoder_jni.h',
|
||||
'app/webrtc/java/jni/androidnetworkmonitor_jni.cc',
|
||||
'app/webrtc/java/jni/androidnetworkmonitor_jni.h',
|
||||
'app/webrtc/java/jni/androidvideocapturer_jni.cc',
|
||||
'app/webrtc/java/jni/androidvideocapturer_jni.h',
|
||||
'app/webrtc/java/jni/classreferenceholder.cc',
|
||||
'app/webrtc/java/jni/classreferenceholder.h',
|
||||
'app/webrtc/java/jni/eglbase_jni.cc',
|
||||
'app/webrtc/java/jni/eglbase_jni.h',
|
||||
'app/webrtc/java/jni/jni_helpers.cc',
|
||||
'app/webrtc/java/jni/jni_helpers.h',
|
||||
'app/webrtc/java/jni/native_handle_impl.cc',
|
||||
'app/webrtc/java/jni/native_handle_impl.h',
|
||||
'app/webrtc/java/jni/peerconnection_jni.cc',
|
||||
'app/webrtc/java/jni/surfacetexturehelper_jni.cc',
|
||||
'app/webrtc/java/jni/surfacetexturehelper_jni.h',
|
||||
],
|
||||
'include_dirs': [
|
||||
'<(libyuv_dir)/include',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="linux"', {
|
||||
'include_dirs': [
|
||||
'<(java_home)/include',
|
||||
'<(java_home)/include/linux',
|
||||
],
|
||||
}],
|
||||
['build_json==1', {
|
||||
'dependencies': [
|
||||
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
|
||||
@ -76,25 +85,6 @@
|
||||
'<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
|
||||
],
|
||||
}],
|
||||
['OS=="android"', {
|
||||
'sources': [
|
||||
'app/webrtc/androidvideocapturer.cc',
|
||||
'app/webrtc/androidvideocapturer.h',
|
||||
'app/webrtc/java/jni/androidmediacodeccommon.h',
|
||||
'app/webrtc/java/jni/androidmediadecoder_jni.cc',
|
||||
'app/webrtc/java/jni/androidmediadecoder_jni.h',
|
||||
'app/webrtc/java/jni/androidmediaencoder_jni.cc',
|
||||
'app/webrtc/java/jni/androidmediaencoder_jni.h',
|
||||
'app/webrtc/java/jni/androidnetworkmonitor_jni.cc',
|
||||
'app/webrtc/java/jni/androidnetworkmonitor_jni.h',
|
||||
'app/webrtc/java/jni/androidvideocapturer_jni.cc',
|
||||
'app/webrtc/java/jni/androidvideocapturer_jni.h',
|
||||
'app/webrtc/java/jni/eglbase_jni.cc',
|
||||
'app/webrtc/java/jni/eglbase_jni.h',
|
||||
'app/webrtc/java/jni/surfacetexturehelper_jni.cc',
|
||||
'app/webrtc/java/jni/surfacetexturehelper_jni.h',
|
||||
]
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
@ -112,144 +102,12 @@
|
||||
# required symbols will be kept.
|
||||
'use_native_jni_exports': 1,
|
||||
},
|
||||
'conditions': [
|
||||
['OS=="linux"', {
|
||||
'defines': [
|
||||
'HAVE_GTK',
|
||||
],
|
||||
'include_dirs': [
|
||||
'<(java_home)/include',
|
||||
'<(java_home)/include/linux',
|
||||
],
|
||||
'conditions': [
|
||||
['use_gtk==1', {
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
'<!@(pkg-config --libs-only-l gobject-2.0 gthread-2.0'
|
||||
' gtk+-2.0)',
|
||||
],
|
||||
},
|
||||
}],
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'libjingle_peerconnection_jar',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
# TODO(jiayl): extract peerconnection_java_files and android_java_files into a webrtc
|
||||
# gyp var that can be included here, or better yet, build a proper .jar in webrtc
|
||||
# and include it here.
|
||||
'variables': {
|
||||
'java_src_dir': 'app/webrtc/java/src',
|
||||
'webrtc_base_dir': '<(webrtc_root)/base',
|
||||
'webrtc_modules_dir': '<(webrtc_root)/modules',
|
||||
'build_jar_log': '<(INTERMEDIATE_DIR)/build_jar.log',
|
||||
'peerconnection_java_files': [
|
||||
'app/webrtc/java/src/org/webrtc/AudioSource.java',
|
||||
'app/webrtc/java/src/org/webrtc/AudioTrack.java',
|
||||
'app/webrtc/java/src/org/webrtc/CallSessionFileRotatingLogSink.java',
|
||||
'app/webrtc/java/src/org/webrtc/DataChannel.java',
|
||||
'app/webrtc/java/src/org/webrtc/IceCandidate.java',
|
||||
'app/webrtc/java/src/org/webrtc/MediaConstraints.java',
|
||||
'app/webrtc/java/src/org/webrtc/MediaSource.java',
|
||||
'app/webrtc/java/src/org/webrtc/MediaStream.java',
|
||||
'app/webrtc/java/src/org/webrtc/MediaStreamTrack.java',
|
||||
'app/webrtc/java/src/org/webrtc/PeerConnectionFactory.java',
|
||||
'app/webrtc/java/src/org/webrtc/PeerConnection.java',
|
||||
'app/webrtc/java/src/org/webrtc/RtpReceiver.java',
|
||||
'app/webrtc/java/src/org/webrtc/RtpSender.java',
|
||||
'app/webrtc/java/src/org/webrtc/SdpObserver.java',
|
||||
'app/webrtc/java/src/org/webrtc/StatsObserver.java',
|
||||
'app/webrtc/java/src/org/webrtc/StatsReport.java',
|
||||
'app/webrtc/java/src/org/webrtc/SessionDescription.java',
|
||||
'app/webrtc/java/src/org/webrtc/VideoCapturer.java',
|
||||
'app/webrtc/java/src/org/webrtc/VideoRenderer.java',
|
||||
'app/webrtc/java/src/org/webrtc/VideoSource.java',
|
||||
'app/webrtc/java/src/org/webrtc/VideoTrack.java',
|
||||
'<(webrtc_base_dir)/java/src/org/webrtc/Logging.java',
|
||||
],
|
||||
'android_java_files': [
|
||||
'app/webrtc/java/android/org/webrtc/Camera2Enumerator.java',
|
||||
'app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java',
|
||||
'app/webrtc/java/android/org/webrtc/CameraEnumerator.java',
|
||||
'app/webrtc/java/android/org/webrtc/EglBase.java',
|
||||
'app/webrtc/java/android/org/webrtc/EglBase10.java',
|
||||
'app/webrtc/java/android/org/webrtc/EglBase14.java',
|
||||
'app/webrtc/java/android/org/webrtc/GlRectDrawer.java',
|
||||
'app/webrtc/java/android/org/webrtc/GlShader.java',
|
||||
'app/webrtc/java/android/org/webrtc/GlUtil.java',
|
||||
'app/webrtc/java/android/org/webrtc/GlTextureFrameBuffer.java',
|
||||
'app/webrtc/java/android/org/webrtc/NetworkMonitor.java',
|
||||
'app/webrtc/java/android/org/webrtc/NetworkMonitorAutoDetect.java',
|
||||
'app/webrtc/java/android/org/webrtc/RendererCommon.java',
|
||||
'app/webrtc/java/android/org/webrtc/SurfaceTextureHelper.java',
|
||||
'app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java',
|
||||
'app/webrtc/java/android/org/webrtc/ThreadUtils.java',
|
||||
'app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java',
|
||||
'app/webrtc/java/android/org/webrtc/VideoRendererGui.java',
|
||||
'app/webrtc/java/src/org/webrtc/MediaCodecVideoDecoder.java',
|
||||
'app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java',
|
||||
'<(webrtc_modules_dir)/video_render/android/java/src/org/webrtc/videoengine/ViEAndroidGLES20.java',
|
||||
'<(webrtc_modules_dir)/video_render/android/java/src/org/webrtc/videoengine/ViERenderer.java',
|
||||
'<(webrtc_modules_dir)/video_render/android/java/src/org/webrtc/videoengine/ViESurfaceRenderer.java',
|
||||
'<(webrtc_modules_dir)/audio_device/android/java/src/org/webrtc/voiceengine/BuildInfo.java',
|
||||
'<(webrtc_modules_dir)/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioEffects.java',
|
||||
'<(webrtc_modules_dir)/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java',
|
||||
'<(webrtc_modules_dir)/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java',
|
||||
'<(webrtc_modules_dir)/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioRecord.java',
|
||||
'<(webrtc_modules_dir)/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java',
|
||||
],
|
||||
},
|
||||
'action_name': 'create_jar',
|
||||
'inputs': [
|
||||
'build/build_jar.sh',
|
||||
'<@(java_files)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/libjingle_peerconnection.jar',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="android"', {
|
||||
'variables': {
|
||||
'java_files': ['<@(peerconnection_java_files)', '<@(android_java_files)'],
|
||||
'build_classpath': '<(java_src_dir):<(DEPTH)/third_party/android_tools/sdk/platforms/android-<(android_sdk_version)/android.jar',
|
||||
},
|
||||
}, {
|
||||
'variables': {
|
||||
'java_files': ['<@(peerconnection_java_files)'],
|
||||
'build_classpath': '<(java_src_dir)',
|
||||
},
|
||||
}],
|
||||
],
|
||||
'action': [
|
||||
'bash', '-ec',
|
||||
'mkdir -p <(INTERMEDIATE_DIR) && '
|
||||
'{ build/build_jar.sh <(java_home) <@(_outputs) '
|
||||
' <(INTERMEDIATE_DIR)/build_jar.tmp '
|
||||
' <(build_classpath) <@(java_files) '
|
||||
' > <(build_jar_log) 2>&1 || '
|
||||
' { cat <(build_jar_log) ; exit 1; } }'
|
||||
],
|
||||
},
|
||||
],
|
||||
'dependencies': [
|
||||
'libjingle_peerconnection_so',
|
||||
],
|
||||
},
|
||||
],
|
||||
}],
|
||||
['OS=="android"', {
|
||||
'targets': [
|
||||
{
|
||||
# |libjingle_peerconnection_java| builds a jar file with name
|
||||
# libjingle_peerconnection_java.jar using Chromes build system.
|
||||
# It includes all Java files needed to setup a PeeerConnection call
|
||||
# from Android.
|
||||
# TODO(perkj): Consider replacing the use of
|
||||
# libjingle_peerconnection_jar with this target everywhere.
|
||||
'target_name': 'libjingle_peerconnection_java',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
|
||||
@ -141,74 +141,6 @@
|
||||
}, # target peerconnection_unittests
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="linux"', {
|
||||
'variables': {
|
||||
'junit_jar': '<(DEPTH)/third_party/junit-jar/junit-4.11.jar',
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'libjingle_peerconnection_test_jar',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'libjingle.gyp:libjingle_peerconnection_jar',
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'variables': {
|
||||
'java_src_dir': 'app/webrtc/javatests/src',
|
||||
'java_files': [
|
||||
'app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java',
|
||||
'app/webrtc/javatests/src/org/webrtc/PeerConnectionTestJava.java',
|
||||
],
|
||||
},
|
||||
'action_name': 'create_jar',
|
||||
'inputs': [
|
||||
'build/build_jar.sh',
|
||||
'<@(java_files)',
|
||||
'<(PRODUCT_DIR)/libjingle_peerconnection.jar',
|
||||
'<(PRODUCT_DIR)/lib/libjingle_peerconnection_so.so',
|
||||
'<(junit_jar)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/libjingle_peerconnection_test.jar',
|
||||
],
|
||||
'action': [
|
||||
'build/build_jar.sh', '<(java_home)', '<@(_outputs)',
|
||||
'<(INTERMEDIATE_DIR)',
|
||||
'<(java_src_dir):<(PRODUCT_DIR)/libjingle_peerconnection.jar:<(junit_jar)',
|
||||
'<@(java_files)'
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'libjingle_peerconnection_java_unittest',
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'copy libjingle_peerconnection_java_unittest',
|
||||
'inputs': [
|
||||
'app/webrtc/javatests/libjingle_peerconnection_java_unittest.sh',
|
||||
'<(PRODUCT_DIR)/libjingle_peerconnection_test_jar',
|
||||
'<(junit_jar)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/libjingle_peerconnection_java_unittest',
|
||||
],
|
||||
'action': [
|
||||
'bash', '-c',
|
||||
'rm -f <(PRODUCT_DIR)/libjingle_peerconnection_java_unittest && '
|
||||
'sed -e "s@GYP_JAVA_HOME@<(java_home)@" '
|
||||
'< app/webrtc/javatests/libjingle_peerconnection_java_unittest.sh '
|
||||
'> <(PRODUCT_DIR)/libjingle_peerconnection_java_unittest && '
|
||||
'cp <(junit_jar) <(PRODUCT_DIR) && '
|
||||
'chmod u+x <(PRODUCT_DIR)/libjingle_peerconnection_java_unittest'
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}],
|
||||
['OS=="android"', {
|
||||
'targets': [
|
||||
{
|
||||
@ -221,7 +153,6 @@
|
||||
'apk_name': 'libjingle_peerconnection_android_unittest',
|
||||
'java_in_dir': 'app/webrtc/androidtests',
|
||||
'resource_dir': 'app/webrtc/androidtests/res',
|
||||
'additional_src_dirs': ['app/webrtc/java/testcommon'],
|
||||
'native_lib_target': 'libjingle_peerconnection_so',
|
||||
'is_test_apk': 1,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user