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 "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 10 #include "content/browser/renderer_host/media/media_stream_manager.h" |
11 #include "content/browser/renderer_host/media/video_capture_manager.h" | 11 #include "content/browser/renderer_host/media/video_capture_manager.h" |
12 #include "content/common/media/video_capture_messages.h" | 12 #include "content/common/media/video_capture_messages.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 VideoCaptureHost::VideoCaptureHost(MediaStreamManager* media_stream_manager) | 16 VideoCaptureHost::VideoCaptureHost(MediaStreamManager* media_stream_manager) |
17 : BrowserMessageFilter(VideoCaptureMsgStart), | 17 : BrowserMessageFilter(VideoCaptureMsgStart), |
18 media_stream_manager_(media_stream_manager) { | 18 media_stream_manager_(media_stream_manager) { |
19 } | 19 } |
20 | 20 |
21 VideoCaptureHost::~VideoCaptureHost() {} | 21 VideoCaptureHost::~VideoCaptureHost() {} |
22 | 22 |
23 void VideoCaptureHost::OnChannelClosing() { | 23 void VideoCaptureHost::OnChannelClosing() { |
24 // Since the IPC channel is gone, close all requested VideoCaptureDevices. | 24 // Since the IPC sender is gone, close all requested VideoCaptureDevices. |
25 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); ) { | 25 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); ) { |
26 const base::WeakPtr<VideoCaptureController>& controller = it->second; | 26 const base::WeakPtr<VideoCaptureController>& controller = it->second; |
27 if (controller) { | 27 if (controller) { |
28 VideoCaptureControllerID controller_id(it->first); | 28 VideoCaptureControllerID controller_id(it->first); |
29 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 29 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
30 controller.get(), controller_id, this, false); | 30 controller.get(), controller_id, this, false); |
31 ++it; | 31 ++it; |
32 } else { | 32 } else { |
33 // Remove the entry for this controller_id so that when the controller | 33 // Remove the entry for this controller_id so that when the controller |
34 // is added, the controller will be notified to stop for this client | 34 // is added, the controller will be notified to stop for this client |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 return; | 352 return; |
353 | 353 |
354 if (it->second) { | 354 if (it->second) { |
355 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 355 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
356 it->second.get(), controller_id, this, on_error); | 356 it->second.get(), controller_id, this, on_error); |
357 } | 357 } |
358 entries_.erase(it); | 358 entries_.erase(it); |
359 } | 359 } |
360 | 360 |
361 } // namespace content | 361 } // namespace content |
OLD | NEW |