Replace the DestroyDeviceInfo with a virtual destructor.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@731 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org 2011-10-12 16:57:53 +00:00
parent 38e400a967
commit 77d7d5455e
15 changed files with 10 additions and 45 deletions

View File

@ -72,7 +72,6 @@ class VideoCaptureModule: public RefCountedModule {
WebRtc_UWord32 positionX, WebRtc_UWord32 positionX,
WebRtc_UWord32 positionY) = 0; WebRtc_UWord32 positionY) = 0;
protected:
virtual ~DeviceInfo() {} virtual ~DeviceInfo() {}
}; };

View File

@ -35,7 +35,6 @@ class VideoCaptureFactory {
static VideoCaptureModule::DeviceInfo* CreateDeviceInfo( static VideoCaptureModule::DeviceInfo* CreateDeviceInfo(
const WebRtc_Word32 id); const WebRtc_Word32 id);
static void DestroyDeviceInfo(VideoCaptureModule::DeviceInfo* deviceInfo);
private: private:
~VideoCaptureFactory(); ~VideoCaptureFactory();

View File

@ -35,17 +35,6 @@ VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo (
return deviceInfo; return deviceInfo;
} }
void VideoCaptureImpl::DestroyDeviceInfo(
VideoCaptureModule::DeviceInfo* deviceInfo)
{
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceVideoCapture, -1,
"%s", __FUNCTION__);
videocapturemodule::DeviceInfoAndroid* devInfo =
static_cast<videocapturemodule::DeviceInfoAndroid*> (deviceInfo);
delete devInfo;
}
DeviceInfoAndroid::DeviceInfoAndroid(const WebRtc_Word32 id) : DeviceInfoAndroid::DeviceInfoAndroid(const WebRtc_Word32 id) :
DeviceInfoImpl(id) DeviceInfoImpl(id)
{ {

View File

@ -43,14 +43,6 @@ VideoCaptureImpl::CreateDeviceInfo(const WebRtc_Word32 id)
return deviceInfo; return deviceInfo;
} }
void VideoCaptureImpl::DestroyDeviceInfo(DeviceInfo* deviceInfo)
{
videocapturemodule::DeviceInfoLinux* devInfo =
static_cast<videocapturemodule::DeviceInfoLinux*> (deviceInfo);
delete devInfo;
}
DeviceInfoLinux::DeviceInfoLinux(const WebRtc_Word32 id) DeviceInfoLinux::DeviceInfoLinux(const WebRtc_Word32 id)
: DeviceInfoImpl(id) : DeviceInfoImpl(id)
{ {

View File

@ -31,19 +31,12 @@ VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
if (!dsInfo || dsInfo->Init() != 0) if (!dsInfo || dsInfo->Init() != 0)
{ {
DestroyDeviceInfo(dsInfo); delete dsInfo;
dsInfo = NULL; dsInfo = NULL;
} }
return dsInfo; return dsInfo;
} }
void VideoCaptureImpl::DestroyDeviceInfo(DeviceInfo* deviceInfo)
{
videocapturemodule::DeviceInfoWindows* impl =
static_cast<videocapturemodule::DeviceInfoWindows*> (deviceInfo);
delete impl;
}
DeviceInfoWindows::DeviceInfoWindows(const WebRtc_Word32 id) DeviceInfoWindows::DeviceInfoWindows(const WebRtc_Word32 id)
: DeviceInfoImpl(id), _dsDevEnum(NULL), _dsMonikerDevEnum(NULL), : DeviceInfoImpl(id), _dsDevEnum(NULL), _dsMonikerDevEnum(NULL),
_CoUninitializeIsRequired(true) _CoUninitializeIsRequired(true)

View File

@ -29,9 +29,4 @@ VideoCaptureModule::DeviceInfo* VideoCaptureFactory::CreateDeviceInfo(
return videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(id); return videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(id);
} }
void VideoCaptureFactory::DestroyDeviceInfo(
VideoCaptureModule::DeviceInfo* deviceInfo) {
videocapturemodule::VideoCaptureImpl::DestroyDeviceInfo(deviceInfo);
}
} // namespace webrtc } // namespace webrtc

View File

@ -49,7 +49,6 @@ public:
VideoCaptureExternal*& externalCapture); VideoCaptureExternal*& externalCapture);
static DeviceInfo* CreateDeviceInfo(const WebRtc_Word32 id); static DeviceInfo* CreateDeviceInfo(const WebRtc_Word32 id);
static void DestroyDeviceInfo(DeviceInfo* deviceInfo);
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ANDROID
static WebRtc_Word32 SetAndroidObjects(void* javaVM, void* javaContext); static WebRtc_Word32 SetAndroidObjects(void* javaVM, void* javaContext);

View File

@ -140,7 +140,7 @@ Java_org_webrtc_capturemoduleandroidtest_VideoCaptureModuleTest_StopCapture(
{ {
if (jniData._videoCapture) { if (jniData._videoCapture) {
jniData._videoCapture->StopCapture(); jniData._videoCapture->StopCapture();
VideoCaptureModule::DestroyDeviceInfo(jniData._captureInfo); delete jniData._captureInfo;
VideoCaptureModule::Destroy(jniData._videoCapture); VideoCaptureModule::Destroy(jniData._videoCapture);
jniData._videoCapture = NULL; jniData._videoCapture = NULL;
jniData._captureInfo = NULL; jniData._captureInfo = NULL;

View File

@ -42,7 +42,7 @@ testCameraEncoder::testCameraEncoder(void)
testCameraEncoder::~testCameraEncoder(void) testCameraEncoder::~testCameraEncoder(void)
{ {
VideoCaptureModule::DestroyDeviceInfo(_captureInfo); delete _captureInfo;
#ifdef RENDER_PREVIEW #ifdef RENDER_PREVIEW
if(_renderer) if(_renderer)

View File

@ -49,7 +49,7 @@ testPlatformDependent::testPlatformDependent(void) :
testPlatformDependent::~testPlatformDependent(void) testPlatformDependent::~testPlatformDependent(void)
{ {
VideoCaptureModule::DestroyDeviceInfo(_captureInfo); delete _captureInfo;
#ifdef RENDER_PREVIEW #ifdef RENDER_PREVIEW
if (_renderer[0]) if (_renderer[0])

View File

@ -90,8 +90,7 @@ ViEInputManager::~ViEInputManager()
#ifndef WEBRTC_VIDEO_EXTERNAL_CAPTURE_AND_RENDER #ifndef WEBRTC_VIDEO_EXTERNAL_CAPTURE_AND_RENDER
if (_ptrCaptureDeviceInfo) if (_ptrCaptureDeviceInfo)
{ {
VideoCaptureFactory::DestroyDeviceInfo( delete _ptrCaptureDeviceInfo;
_ptrCaptureDeviceInfo);
_ptrCaptureDeviceInfo = NULL; _ptrCaptureDeviceInfo = NULL;
} }
#endif #endif

View File

@ -56,7 +56,7 @@ tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
break; break;
} }
} }
webrtc::VideoCaptureFactory::DestroyDeviceInfo(devInfo); delete devInfo;
numberOfErrors += ViETest::TestError( numberOfErrors += ViETest::TestError(
captureDeviceSet, "ERROR: %s at line %d - Could not set capture device", captureDeviceSet, "ERROR: %s at line %d - Could not set capture device",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);

View File

@ -116,7 +116,7 @@ int ViEAutoTest::ViEBaseStandardTest()
vcpm = NULL; vcpm = NULL;
} }
} }
webrtc::VideoCaptureFactory::DestroyDeviceInfo(devInfo); delete devInfo;
numberOfErrors+= ViETest::TestError( numberOfErrors+= ViETest::TestError(
captureDeviceSet, captureDeviceSet,

View File

@ -338,7 +338,7 @@ int ViEAutoTest::ViECaptureStandardTest()
ViETest::Log(" "); ViETest::Log(" ");
return numberOfErrors; return numberOfErrors;
} }
webrtc::VideoCaptureFactory::DestroyDeviceInfo(devInfo); delete devInfo;
ViETest::Log(" "); ViETest::Log(" ");
ViETest::Log(" ViECapture Standard Test PASSED!"); ViETest::Log(" ViECapture Standard Test PASSED!");
@ -558,7 +558,7 @@ int ViEAutoTest::ViECaptureAPITest()
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d", numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
webrtc::VideoCaptureFactory::DestroyDeviceInfo(devInfo); delete devInfo;
vcpm->Release(); vcpm->Release();
//*************************************************************** //***************************************************************

View File

@ -241,7 +241,7 @@ scoped_refptr<webrtc::VideoCaptureModule> Conductor::OpenVideoCaptureDevice() {
if (video_device.get()) if (video_device.get())
break; break;
} }
webrtc::VideoCaptureFactory::DestroyDeviceInfo(device_info); delete device_info;
return video_device; return video_device;
} }