Delete VideoReceiveStream channels in destructor.

R=stefan@webrtc.org
BUG=1667

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7611 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-11-04 13:48:15 +00:00
parent 6de75ca3ed
commit 09cc686c8b
2 changed files with 37 additions and 1 deletions

View File

@ -2140,4 +2140,39 @@ TEST_F(EndToEndTest, NewReceiveStreamsRespectNetworkDown) {
DestroyStreams();
}
// TODO(pbos): Remove this regression test when VideoEngine is no longer used as
// a backend. This is to test that we hand channels back properly.
TEST_F(EndToEndTest, CanCreateAndDestroyManyVideoStreams) {
test::NullTransport transport;
scoped_ptr<Call> call(Call::Create(Call::Config(&transport)));
test::FakeDecoder fake_decoder;
test::FakeEncoder fake_encoder(Clock::GetRealTimeClock());
for (size_t i = 0; i < 100; ++i) {
VideoSendStream::Config send_config;
send_config.encoder_settings.encoder = &fake_encoder;
send_config.encoder_settings.payload_name = "FAKE";
send_config.encoder_settings.payload_type = 123;
VideoEncoderConfig encoder_config;
encoder_config.streams = test::CreateVideoStreams(1);
send_config.rtp.ssrcs.push_back(1);
VideoSendStream* send_stream =
call->CreateVideoSendStream(send_config, encoder_config);
call->DestroyVideoSendStream(send_stream);
VideoReceiveStream::Config receive_config;
receive_config.rtp.remote_ssrc = 1;
receive_config.rtp.local_ssrc = kReceiverLocalSsrc;
VideoReceiveStream::Decoder decoder;
decoder.decoder = &fake_decoder;
decoder.payload_type = 123;
decoder.payload_name = "FAKE";
receive_config.decoders.push_back(decoder);
VideoReceiveStream* receive_stream =
call->CreateVideoReceiveStream(receive_config);
call->DestroyVideoReceiveStream(receive_stream);
}
}
} // namespace webrtc

View File

@ -222,7 +222,6 @@ VideoReceiveStream::~VideoReceiveStream() {
video_engine_base_->SetVoiceEngine(NULL);
image_process_->Release();
video_engine_base_->Release();
external_codec_->Release();
codec_->DeregisterDecoderObserver(channel_);
rtp_rtcp_->DeregisterReceiveChannelRtpStatisticsCallback(channel_,
@ -233,6 +232,8 @@ VideoReceiveStream::~VideoReceiveStream() {
network_->Release();
render_->Release();
rtp_rtcp_->Release();
video_engine_base_->DeleteChannel(channel_);
video_engine_base_->Release();
}
void VideoReceiveStream::Start() {