| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 VIDEO_CAPTURE_STATE_STOPPED)); | 230 VIDEO_CAPTURE_STATE_STOPPED)); |
| 231 DeleteVideoCaptureController(controller_id, false); | 231 DeleteVideoCaptureController(controller_id, false); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void VideoCaptureHost::OnPauseCapture(int device_id) { | 234 void VideoCaptureHost::OnPauseCapture(int device_id) { |
| 235 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 235 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 236 DVLOG(1) << "VideoCaptureHost::OnPauseCapture, device_id " << device_id; | 236 DVLOG(1) << "VideoCaptureHost::OnPauseCapture, device_id " << device_id; |
| 237 | 237 |
| 238 VideoCaptureControllerID controller_id(device_id); | 238 VideoCaptureControllerID controller_id(device_id); |
| 239 EntryMap::iterator it = entries_.find(controller_id); | 239 EntryMap::iterator it = entries_.find(controller_id); |
| 240 if (it == entries_.end()) | 240 if (it == entries_.end() || !it->second) |
| 241 return; | 241 return; |
| 242 | 242 |
| 243 if (it->second) { | 243 media_stream_manager_->video_capture_manager()->PauseCaptureForClient( |
| 244 media_stream_manager_->video_capture_manager()->PauseCaptureForClient( | 244 it->second.get(), controller_id, this); |
| 245 it->second.get(), controller_id, this); | 245 Send(new VideoCaptureMsg_StateChanged(device_id, VIDEO_CAPTURE_STATE_PAUSED)); |
| 246 } | |
| 247 } | 246 } |
| 248 | 247 |
| 249 void VideoCaptureHost::OnResumeCapture( | 248 void VideoCaptureHost::OnResumeCapture( |
| 250 int device_id, | 249 int device_id, |
| 251 media::VideoCaptureSessionId session_id, | 250 media::VideoCaptureSessionId session_id, |
| 252 const media::VideoCaptureParams& params) { | 251 const media::VideoCaptureParams& params) { |
| 253 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 252 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 254 DVLOG(1) << "VideoCaptureHost::OnResumeCapture, device_id " << device_id; | 253 DVLOG(1) << "VideoCaptureHost::OnResumeCapture, device_id " << device_id; |
| 255 | 254 |
| 256 VideoCaptureControllerID controller_id(device_id); | 255 VideoCaptureControllerID controller_id(device_id); |
| 257 EntryMap::iterator it = entries_.find(controller_id); | 256 EntryMap::iterator it = entries_.find(controller_id); |
| 258 if (it == entries_.end()) | 257 if (it == entries_.end() || !it->second) |
| 259 return; | 258 return; |
| 260 | 259 |
| 261 if (it->second) { | 260 media_stream_manager_->video_capture_manager()->ResumeCaptureForClient( |
| 262 media_stream_manager_->video_capture_manager()->ResumeCaptureForClient( | 261 session_id, params, it->second.get(), controller_id, this); |
| 263 session_id, params, it->second.get(), controller_id, this); | 262 Send(new VideoCaptureMsg_StateChanged(device_id, |
| 264 } | 263 VIDEO_CAPTURE_STATE_RESUMED)); |
| 265 } | 264 } |
| 266 | 265 |
| 267 void VideoCaptureHost::OnRequestRefreshFrame(int device_id) { | 266 void VideoCaptureHost::OnRequestRefreshFrame(int device_id) { |
| 268 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 267 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 269 DVLOG(1) << "VideoCaptureHost::OnRequestRefreshFrame, device_id " | 268 DVLOG(1) << "VideoCaptureHost::OnRequestRefreshFrame, device_id " |
| 270 << device_id; | 269 << device_id; |
| 271 | 270 |
| 272 VideoCaptureControllerID controller_id(device_id); | 271 VideoCaptureControllerID controller_id(device_id); |
| 273 EntryMap::iterator it = entries_.find(controller_id); | 272 EntryMap::iterator it = entries_.find(controller_id); |
| 274 if (it == entries_.end()) | 273 if (it == entries_.end()) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 return; | 340 return; |
| 342 | 341 |
| 343 if (it->second) { | 342 if (it->second) { |
| 344 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 343 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
| 345 it->second.get(), controller_id, this, on_error); | 344 it->second.get(), controller_id, this, on_error); |
| 346 } | 345 } |
| 347 entries_.erase(it); | 346 entries_.erase(it); |
| 348 } | 347 } |
| 349 | 348 |
| 350 } // namespace content | 349 } // namespace content |
| OLD | NEW |