Change Video capture module to be reference counting. Also prevent the module from beeing deleted using the interface.

Furthermore remove all static module creation and deletion functions.
Review URL: http://webrtc-codereview.appspot.com/133012

git-svn-id: http://webrtc.googlecode.com/svn/trunk@580 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
perkj@webrtc.org
2011-09-12 08:53:36 +00:00
parent 31c6b60456
commit 0cc68dc38a
26 changed files with 320 additions and 795 deletions

View File

@@ -116,6 +116,8 @@ WebRtcVideoEngine::WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
voice_engine_(voice_engine),
log_level_(kDefaultLogSeverity),
capture_started_(false) {
if(capture_)
capture_->AddRef();
}
WebRtcVideoEngine::WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
@@ -137,7 +139,7 @@ WebRtcVideoEngine::~WebRtcVideoEngine() {
Terminate();
vie_wrapper_.reset();
if (capture_) {
webrtc::VideoCaptureModule::Destroy(capture_);
capture_->Release();
}
if (renderer_) {
webrtc::VideoRender::DestroyVideoRender(renderer_);
@@ -382,9 +384,10 @@ bool WebRtcVideoEngine::SetCaptureDevice(const Device* cam) {
bool WebRtcVideoEngine::SetCaptureModule(webrtc::VideoCaptureModule* vcm) {
ReleaseCaptureDevice();
if (capture_) {
webrtc::VideoCaptureModule::Destroy(capture_);
capture_->Release();
}
capture_ = vcm;
capture_->AddRef();
external_capture_ = true;
return true;
}