Make the destructor of AudioCodingModule public.
This allows the type to be used with a scoped_ptr. Remove all calls to
the deprecated Destroy() from tests.
R=turaj@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2200006
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4731 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/main/test/EncodeDecodeTest.cc b/webrtc/modules/audio_coding/main/test/EncodeDecodeTest.cc
index 6ba6186..bab207c 100644
--- a/webrtc/modules/audio_coding/main/test/EncodeDecodeTest.cc
+++ b/webrtc/modules/audio_coding/main/test/EncodeDecodeTest.cc
@@ -22,6 +22,7 @@
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
#include "webrtc/modules/audio_coding/main/source/acm_common_defs.h"
#include "webrtc/modules/audio_coding/main/test/utility.h"
+#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/test/testsupport/fileutils.h"
@@ -269,7 +270,7 @@
codePars[1] = 0;
codePars[2] = 0;
- AudioCodingModule* acm = AudioCodingModule::Create(0);
+ scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0));
struct CodecInst sendCodecTmp;
numCodecs = acm->NumberOfCodecs();
@@ -309,15 +310,13 @@
_receiver.codeId = codeId;
rtpFile.ReadHeader();
- _receiver.Setup(acm, &rtpFile);
+ _receiver.Setup(acm.get(), &rtpFile);
_receiver.Run();
_receiver.Teardown();
rtpFile.Close();
}
}
- AudioCodingModule::Destroy(acm);
-
// End tracing.
if (_testMode == 1) {
Trace::ReturnTrace();
@@ -326,7 +325,7 @@
void EncodeDecodeTest::EncodeToFile(int fileType, int codeId, int* codePars,
int testMode) {
- AudioCodingModule* acm = AudioCodingModule::Create(1);
+ scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(1));
RTPFile rtpFile;
std::string fileName = webrtc::test::OutputPath() + "outFile.rtp";
rtpFile.Open(fileName.c_str(), "wb+");
@@ -336,14 +335,13 @@
_sender.testMode = testMode;
_sender.codeId = codeId;
- _sender.Setup(acm, &rtpFile);
+ _sender.Setup(acm.get(), &rtpFile);
struct CodecInst sendCodecInst;
if (acm->SendCodec(&sendCodecInst) >= 0) {
_sender.Run();
}
_sender.Teardown();
rtpFile.Close();
- AudioCodingModule::Destroy(acm);
}
} // namespace webrtc