Fixed vie_auto_test shutdown race conditions.

Fixed a race condition crash in vie_auto_test shutdown. Certain tests did not clean up the voice engine properly which caused crashes during certain uncommon timing conditions.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/307001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1109 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
phoglund@webrtc.org 2011-12-06 10:42:05 +00:00
parent eff3c8905f
commit 048b037342
3 changed files with 12 additions and 1 deletions

View File

@ -189,7 +189,11 @@ void ViEAutoTest::ViEBaseAPITest() {
"Should fail: disconnecting bogus channel"; "Should fail: disconnecting bogus channel";
EXPECT_EQ(0, ptrViEBase->DisconnectAudioChannel(videoChannel)); EXPECT_EQ(0, ptrViEBase->DisconnectAudioChannel(videoChannel));
// Clean up voice engine
EXPECT_EQ(0, ptrViEBase->SetVoiceEngine(NULL)); EXPECT_EQ(0, ptrViEBase->SetVoiceEngine(NULL));
EXPECT_EQ(0, ptrVoEBase->Release());
EXPECT_TRUE(webrtc::VoiceEngine::Delete(ptrVoE));
webrtc::ViEBase* ptrViEBase2 = webrtc::ViEBase::GetInterface(ptrViE); webrtc::ViEBase* ptrViEBase2 = webrtc::ViEBase::GetInterface(ptrViE);
EXPECT_TRUE(NULL != ptrViEBase2); EXPECT_TRUE(NULL != ptrViEBase2);

View File

@ -463,6 +463,12 @@ void ViEAutoTest::ViEFileStandardTest()
// Testing finished. Tear down Video Engine // Testing finished. Tear down Video Engine
//*************************************************************** //***************************************************************
EXPECT_EQ(0, ptrViEBase->DisconnectAudioChannel(videoChannel));
EXPECT_EQ(0, ptrViEBase->SetVoiceEngine(NULL));
EXPECT_EQ(0, ptrVEBase->DeleteChannel(audioChannel));
EXPECT_EQ(0, ptrVEBase->Release());
EXPECT_EQ(0, ptrVECodec->Release());
EXPECT_TRUE(webrtc::VoiceEngine::Delete(ptrVEEngine));
EXPECT_EQ(0, ptrViEBase->StopReceive(videoChannel)); EXPECT_EQ(0, ptrViEBase->StopReceive(videoChannel));
EXPECT_EQ(0, ptrViEBase->StopSend(videoChannel)); EXPECT_EQ(0, ptrViEBase->StopSend(videoChannel));

View File

@ -31,7 +31,8 @@ class ViEBaseImpl
// Initializes VideoEngine and must be called before any other API is called. // Initializes VideoEngine and must be called before any other API is called.
virtual int Init(); virtual int Init();
// Connects ViE to a VoE instance. // Connects ViE to a VoE instance. Pass in NULL to forget about a previously
// set voice engine and release all resources we allocated from it.
virtual int SetVoiceEngine(VoiceEngine* voice_engine); virtual int SetVoiceEngine(VoiceEngine* voice_engine);
// Creates a new ViE channel. // Creates a new ViE channel.