Avoid a leak in AudioCodingModuleTest.TestIsac. The leak was caught by LSAN.

BUG=2515
TEST=reproduced locally on linux and verified the fix resolves the issue.
R=henrik.lundin@webrtc.org, kjellander@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5048 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
turaj@webrtc.org 2013-10-29 04:40:09 +00:00
parent 9ca93a8b8e
commit 55e1723713
3 changed files with 14 additions and 20 deletions

View File

@ -44,7 +44,3 @@ leak:talk_base::OpenSSLIdentity::FromPEMStrings
leak:talk_base::TaskParent::TaskParent
leak:talk_base::unstarted_task_test_DoNotDeleteTask2_Test::TestBody
# modules_tests
# https://code.google.com/p/webrtc/issues/detail?id=2515
leak:AudioCodingModuleTest_TestIsac_Test::TestBody

View File

@ -92,10 +92,7 @@ ISACTest::ISACTest(int testMode, const Config& config)
_testMode(testMode) {
}
ISACTest::~ISACTest() {
delete _channel_A2B;
delete _channel_B2A;
}
ISACTest::~ISACTest() {}
void ISACTest::Setup() {
int codecCntr;
@ -123,14 +120,14 @@ void ISACTest::Setup() {
EXPECT_EQ(0, _acmB->RegisterReceiveCodec(_paramISAC32kHz));
//--- Set A-to-B channel
_channel_A2B = new Channel;
EXPECT_EQ(0, _acmA->RegisterTransportCallback(_channel_A2B));
_channel_A2B->RegisterReceiverACM(_acmB);
_channel_A2B.reset(new Channel);
EXPECT_EQ(0, _acmA->RegisterTransportCallback(_channel_A2B.get()));
_channel_A2B->RegisterReceiverACM(_acmB.get());
//--- Set B-to-A channel
_channel_B2A = new Channel;
EXPECT_EQ(0, _acmB->RegisterTransportCallback(_channel_B2A));
_channel_B2A->RegisterReceiverACM(_acmA);
_channel_B2A.reset(new Channel);
EXPECT_EQ(0, _acmB->RegisterTransportCallback(_channel_B2A.get()));
_channel_B2A->RegisterReceiverACM(_acmA.get());
file_name_swb_ = webrtc::test::ResourcePath("audio_coding/testfile32kHz",
"pcm");
@ -284,8 +281,8 @@ void ISACTest::EncodeDecode(int testNr, ACMTestISACConfig& wbISACConfig,
EXPECT_EQ(0, _acmB->RegisterSendCodec(_paramISAC16kHz));
// Side A is sending super-wideband, and side B is sending wideband.
SetISAConfig(swbISACConfig, _acmA, _testMode);
SetISAConfig(wbISACConfig, _acmB, _testMode);
SetISAConfig(swbISACConfig, _acmA.get(), _testMode);
SetISAConfig(wbISACConfig, _acmB.get(), _testMode);
bool adaptiveMode = false;
if ((swbISACConfig.currentRateBitPerSec == -1)

View File

@ -20,6 +20,7 @@
#include "webrtc/modules/audio_coding/main/test/Channel.h"
#include "webrtc/modules/audio_coding/main/test/PCMFile.h"
#include "webrtc/modules/audio_coding/main/test/utility.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#define MAX_FILE_NAME_LENGTH_BYTE 500
#define NO_OF_CLIENTS 15
@ -55,11 +56,11 @@ class ISACTest : public ACMTest {
void SwitchingSamplingRate(int testNr, int maxSampRateChange);
AudioCodingModule* _acmA;
AudioCodingModule* _acmB;
scoped_ptr<AudioCodingModule> _acmA;
scoped_ptr<AudioCodingModule> _acmB;
Channel* _channel_A2B;
Channel* _channel_B2A;
scoped_ptr<Channel> _channel_A2B;
scoped_ptr<Channel> _channel_B2A;
PCMFile _inFileA;
PCMFile _inFileB;