WebRTCDemo: Enable making multiple calls.

Previously after the first call subsequent attempts to bind the RTP/RTCP ports would fail, since r3754.

BUG=1618

Review URL: https://webrtc-codereview.appspot.com/1302007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3817 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
fischman@webrtc.org 2013-04-10 20:33:27 +00:00
parent 59d8889704
commit 6f41ca9fd2
5 changed files with 43 additions and 10 deletions

View File

@ -20,6 +20,11 @@
#include "webrtc/voice_engine/include/voe_network.h"
#include "webrtc/video_engine/vie_defines.h"
#ifdef WEBRTC_ANDROID
#undef NDEBUG
#include <assert.h>
#endif
namespace webrtc {
namespace test {
@ -29,11 +34,12 @@ VoiceChannelTransport::VoiceChannelTransport(VoENetwork* voe_network,
voe_network_(voe_network) {
uint8_t socket_threads = 1;
socket_transport_ = UdpTransport::Create(channel, socket_threads);
int registered = voe_network_->RegisterExternalTransport(channel,
*socket_transport_);
#ifndef WEBRTC_ANDROID
EXPECT_EQ(0, voe_network_->RegisterExternalTransport(channel,
*socket_transport_));
EXPECT_EQ(0, registered);
#else
voe_network_->RegisterExternalTransport(channel, *socket_transport_);
assert(registered == 0);
#endif
}
@ -80,14 +86,15 @@ VideoChannelTransport::VideoChannelTransport(ViENetwork* vie_network,
vie_network_(vie_network) {
uint8_t socket_threads = 1;
socket_transport_ = UdpTransport::Create(channel, socket_threads);
int registered = vie_network_->RegisterSendTransport(channel,
*socket_transport_);
#ifndef WEBRTC_ANDROID
EXPECT_EQ(0, vie_network_->RegisterSendTransport(channel,
*socket_transport_));
EXPECT_EQ(0, registered);
#else
vie_network_->RegisterSendTransport(channel, *socket_transport_);
assert(registered == 0);
#endif
}
VideoChannelTransport::~VideoChannelTransport() {
vie_network_->DeregisterSendTransport(channel_);
UdpTransport::Destroy(socket_transport_);

View File

@ -289,6 +289,14 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Cre
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1DeleteChannel
(JNIEnv *, jobject, jint);
/*
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
* Method: ViE_DeleteChannel
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_ViE_1DeleteChannel
(JNIEnv *, jobject, jint);
/*
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
* Method: VoE_SetLocalReceiver

View File

@ -382,7 +382,7 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_Init(
__android_log_write(ANDROID_LOG_DEBUG, WEBRTC_LOG_TAG,
"SetTraceFilter");
if (0 != vieData.vie->SetTraceFilter(webrtc::kTraceDefault))
if (0 != vieData.vie->SetTraceFilter(webrtc::kTraceError))
{
__android_log_write(ANDROID_LOG_WARN, WEBRTC_LOG_TAG,
"Could not set trace filter");
@ -1291,6 +1291,21 @@ JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_VoE_1Del
return voeData.base->DeleteChannel(channel);
}
/*
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
* Method: ViE_DeleteChannel
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_webrtc_videoengineapp_ViEAndroidJavaAPI_ViE_1DeleteChannel(
JNIEnv *,
jobject,
jint channel)
{
VALIDATE_BASE_POINTER;
vieData.transport.reset(NULL);
return vieData.base->DeleteChannel(channel);
}
/*
* Class: org_webrtc_videoengineapp_ViEAndroidJavaAPI
* Method: VoE_SetLocalReceiver

View File

@ -100,6 +100,7 @@ public class ViEAndroidJavaAPI {
// Channel functions
public native int VoE_CreateChannel();
public native int VoE_DeleteChannel(int channel);
public native int ViE_DeleteChannel(int channel);
// Receiver & Destination functions
public native int VoE_SetLocalReceiver(int channel, int port);

View File

@ -78,7 +78,7 @@ public class WebRTCDemo extends TabActivity implements IViEAndroidCallback,
private SurfaceView svLocal = null;
// channel number
private int channel;
private int channel = -1;
private int cameraId;
private int voiceChannel = -1;
@ -87,7 +87,7 @@ public class WebRTCDemo extends TabActivity implements IViEAndroidCallback,
private boolean voERunning = false;
// debug
private boolean enableTrace = false;
private boolean enableTrace = true;
// Constant
private static final String TAG = "WEBRTC";
@ -418,6 +418,8 @@ public class WebRTCDemo extends TabActivity implements IViEAndroidCallback,
vieAndroidAPI.StopReceive(channel);
vieAndroidAPI.StopSend(channel);
vieAndroidAPI.RemoveRemoteRenderer(channel);
vieAndroidAPI.ViE_DeleteChannel(channel);
channel = -1;
vieAndroidAPI.StopCamera(cameraId);
vieAndroidAPI.Terminate();
mLlRemoteSurface.removeView(remoteSurfaceView);