Clean packets on the network when closing + made loopback test actually run again.

BUG=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3776 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2013-04-08 10:42:50 +00:00
parent ff7e1303e8
commit 367804cce2
2 changed files with 26 additions and 9 deletions

View File

@ -497,11 +497,9 @@ int VideoEngineSampleCode(void* window1, void* window2)
return -1; return -1;
} }
// Setting External transport // Setup transport.
TbExternalTransport extTransport(*(ptrViENetwork), videoChannel, NULL); TbExternalTransport* extTransport = NULL;
webrtc::test::VideoChannelTransport* video_channel_transport = NULL;
webrtc::test::VideoChannelTransport* video_channel_transport =
new webrtc::test::VideoChannelTransport(ptrViENetwork, videoChannel);
int testMode = 0; int testMode = 0;
std::cout << std::endl; std::cout << std::endl;
@ -515,8 +513,11 @@ int VideoEngineSampleCode(void* window1, void* window2)
// Avoid changing SSRC due to collision. // Avoid changing SSRC due to collision.
error = ptrViERtpRtcp->SetLocalSSRC(videoChannel, 1); error = ptrViERtpRtcp->SetLocalSSRC(videoChannel, 1);
extTransport = new TbExternalTransport(*ptrViENetwork, videoChannel,
NULL);
error = ptrViENetwork->RegisterSendTransport(videoChannel, error = ptrViENetwork->RegisterSendTransport(videoChannel,
extTransport); *extTransport);
if (error == -1) if (error == -1)
{ {
printf("ERROR in ViECodec::RegisterSendTransport \n"); printf("ERROR in ViECodec::RegisterSendTransport \n");
@ -540,16 +541,19 @@ int VideoEngineSampleCode(void* window1, void* window2)
std::string delay_str; std::string delay_str;
std::getline(std::cin, delay_str); std::getline(std::cin, delay_str);
network.mean_one_way_delay = atoi(delay_str.c_str()); network.mean_one_way_delay = atoi(delay_str.c_str());
extTransport.SetNetworkParameters(network); extTransport->SetNetworkParameters(network);
if (numTemporalLayers > 1 && temporalToggling) { if (numTemporalLayers > 1 && temporalToggling) {
extTransport.SetTemporalToggle(numTemporalLayers); extTransport->SetTemporalToggle(numTemporalLayers);
} else { } else {
// Disabled // Disabled
extTransport.SetTemporalToggle(0); extTransport->SetTemporalToggle(0);
} }
} }
else else
{ {
video_channel_transport = new webrtc::test::VideoChannelTransport(
ptrViENetwork, videoChannel);
const char* ipAddress = "127.0.0.1"; const char* ipAddress = "127.0.0.1";
const unsigned short rtpPort = 6000; const unsigned short rtpPort = 6000;
std::cout << std::endl; std::cout << std::endl;
@ -668,7 +672,10 @@ int VideoEngineSampleCode(void* window1, void* window2)
printf("ERROR in ViEBase::DeleteChannel\n"); printf("ERROR in ViEBase::DeleteChannel\n");
return -1; return -1;
} }
delete video_channel_transport; delete video_channel_transport;
delete extTransport;
int remainingInterfaces = 0; int remainingInterfaces = 0;
remainingInterfaces = ptrViECodec->Release(); remainingInterfaces = ptrViECodec->Release();
remainingInterfaces += ptrViECapture->Release(); remainingInterfaces += ptrViECapture->Release();

View File

@ -91,6 +91,16 @@ TbExternalTransport::~TbExternalTransport()
delete &_thread; delete &_thread;
delete &_event; delete &_event;
} }
for (std::list<VideoPacket*>::iterator it = _rtpPackets.begin();
it != _rtpPackets.end(); ++it) {
delete *it;
}
_rtpPackets.clear();
for (std::list<VideoPacket*>::iterator it = _rtcpPackets.begin();
it != _rtcpPackets.end(); ++it) {
delete *it;
}
_rtcpPackets.clear();
delete &_crit; delete &_crit;
delete &_statCrit; delete &_statCrit;
} }