| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/media/video_capture_host.h" | 5 #include "content/browser/renderer_host/media/video_capture_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/browser/browser_main_loop.h" |
| 10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 11 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 11 #include "content/browser/renderer_host/media/video_capture_manager.h" | 12 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 12 #include "content/common/media/video_capture_messages.h" | 13 #include "content/common/media/video_capture_messages.h" |
| 13 | 14 |
| 15 using content::BrowserMainLoop; |
| 14 using content::BrowserMessageFilter; | 16 using content::BrowserMessageFilter; |
| 15 using content::BrowserThread; | 17 using content::BrowserThread; |
| 16 | 18 |
| 17 struct VideoCaptureHost::Entry { | 19 struct VideoCaptureHost::Entry { |
| 18 Entry(VideoCaptureController* controller) | 20 Entry(VideoCaptureController* controller) |
| 19 : controller(controller) {} | 21 : controller(controller) {} |
| 20 | 22 |
| 21 ~Entry() {} | 23 ~Entry() {} |
| 22 | 24 |
| 23 scoped_refptr<VideoCaptureController> controller; | 25 scoped_refptr<VideoCaptureController> controller; |
| 24 }; | 26 }; |
| 25 | 27 |
| 26 VideoCaptureHost::VideoCaptureHost(content::ResourceContext* resource_context, | 28 VideoCaptureHost::VideoCaptureHost() {} |
| 27 media::AudioManager* audio_manager) | |
| 28 : resource_context_(resource_context), | |
| 29 audio_manager_(audio_manager) { | |
| 30 } | |
| 31 | 29 |
| 32 VideoCaptureHost::~VideoCaptureHost() {} | 30 VideoCaptureHost::~VideoCaptureHost() {} |
| 33 | 31 |
| 34 void VideoCaptureHost::OnChannelClosing() { | 32 void VideoCaptureHost::OnChannelClosing() { |
| 35 BrowserMessageFilter::OnChannelClosing(); | 33 BrowserMessageFilter::OnChannelClosing(); |
| 36 | 34 |
| 37 // Since the IPC channel is gone, close all requested VideCaptureDevices. | 35 // Since the IPC channel is gone, close all requested VideCaptureDevices. |
| 38 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { | 36 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { |
| 39 VideoCaptureController* controller = it->second->controller; | 37 VideoCaptureController* controller = it->second->controller; |
| 40 if (controller) { | 38 if (controller) { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 if (controller) { | 272 if (controller) { |
| 275 controller->StopCapture(controller_id, this); | 273 controller->StopCapture(controller_id, this); |
| 276 GetVideoCaptureManager()->RemoveController(controller, this); | 274 GetVideoCaptureManager()->RemoveController(controller, this); |
| 277 } | 275 } |
| 278 delete it->second; | 276 delete it->second; |
| 279 entries_.erase(controller_id); | 277 entries_.erase(controller_id); |
| 280 } | 278 } |
| 281 | 279 |
| 282 media_stream::VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() { | 280 media_stream::VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() { |
| 283 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 284 return media_stream::MediaStreamManager::GetForResourceContext( | 282 return BrowserMainLoop::GetMediaStreamManager()->video_capture_manager(); |
| 285 resource_context_, audio_manager_)->video_capture_manager(); | |
| 286 } | 283 } |
| OLD | NEW |