From 9c89e932c92dd8a977fdf6f777ae76c4d581c92e Mon Sep 17 00:00:00 2001 From: "braveyao@webrtc.org" Date: Thu, 3 Jul 2014 05:59:22 +0000 Subject: [PATCH] WebRTCDemo: set local SSRC for loopback test, otherwise receiver would reset it due to ssrc clash, which would cause delayed remote rendering. (Including another fix here, https://review.webrtc.org/16779004/, to make the test run) BUG=3500 TEST=Manual Test R=glaznev@webrtc.org Review URL: https://webrtc-codereview.appspot.com/13819004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6587 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../android/media_demo/jni/video_engine_jni.cc | 6 ++++++ .../src/org/webrtc/webrtcdemo/MediaEngine.java | 10 +++++++++- .../src/org/webrtc/webrtcdemo/VideoEngine.java | 1 + webrtc/webrtc_examples.gyp | 1 - 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/webrtc/examples/android/media_demo/jni/video_engine_jni.cc b/webrtc/examples/android/media_demo/jni/video_engine_jni.cc index c6589ece6..c7af1c54f 100644 --- a/webrtc/examples/android/media_demo/jni/video_engine_jni.cc +++ b/webrtc/examples/android/media_demo/jni/video_engine_jni.cc @@ -710,3 +710,9 @@ JOWW(void, VideoCodecInst_setMaxFrameRate)(JNIEnv* jni, jobject j_codec, JOWW(void, CameraDesc_dispose)(JNIEnv* jni, jobject j_camera) { delete GetCameraDesc(jni, j_camera); } + +JOWW(jint, VideoEngine_setLocalSSRC)(JNIEnv* jni, jobject j_vie, jint channel, + jint ssrc) { + VideoEngineData* vie_data = GetVideoEngineData(jni, j_vie); + return vie_data->rtp->SetLocalSSRC(channel, ssrc); +} diff --git a/webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/MediaEngine.java b/webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/MediaEngine.java index f62843158..f55bcccfb 100644 --- a/webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/MediaEngine.java +++ b/webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/MediaEngine.java @@ -259,7 +259,7 @@ public class MediaEngine implements VideoDecodeEncodeObserver { public void setTrace(boolean enable) { if (enable) { vie.setTraceFile("/sdcard/trace.txt", false); - vie.setTraceFilter(VideoEngine.TraceLevel.TRACE_ERROR); + vie.setTraceFilter(VideoEngine.TraceLevel.TRACE_ALL); return; } vie.setTraceFilter(VideoEngine.TraceLevel.TRACE_NONE); @@ -561,6 +561,14 @@ public class MediaEngine implements VideoDecodeEncodeObserver { check(vie.setSendDestination(videoChannel, videoTxPort, remoteIp) == 0, "Failed setSendDestination"); } + + // Setting localSSRC manually (arbitrary value) for loopback test, + // As otherwise we will get a clash and a new SSRC will be set, + // Which will reset the receiver and other minor issues. + if (remoteIp.equals("127.0.0.1")) { + check(vie.setLocalSSRC(videoChannel, 0x01234567) == 0, + "Failed setLocalSSRC"); + } } public int videoTxPort() { diff --git a/webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/VideoEngine.java b/webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/VideoEngine.java index 7cfa5856d..677ff42fb 100644 --- a/webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/VideoEngine.java +++ b/webrtc/examples/android/media_demo/src/org/webrtc/webrtcdemo/VideoEngine.java @@ -116,4 +116,5 @@ public class VideoEngine { return stopRtpDump(channel, direction.ordinal()); } private native int stopRtpDump(int channel, int direction); + public native int setLocalSSRC(int channel, int ssrc); } diff --git a/webrtc/webrtc_examples.gyp b/webrtc/webrtc_examples.gyp index 56a0e9efd..e8d1b9828 100644 --- a/webrtc/webrtc_examples.gyp +++ b/webrtc/webrtc_examples.gyp @@ -15,7 +15,6 @@ 'type': 'loadable_module', 'dependencies': [ '<(DEPTH)/third_party/icu/icu.gyp:icuuc', - '<(webrtc_root)/modules/modules.gyp:*', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:field_trial_default', '<(webrtc_root)/test/test.gyp:channel_transport', '<(webrtc_root)/video_engine/video_engine.gyp:video_engine_core',