Chromium Code Reviews| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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()) |
| 241 return; | 241 return; |
| 242 | 242 |
| 243 if (it->second) { | 243 if (it->second) { |
|
mcasas
2016/09/28 21:34:43
prefer early return?
if (!it->second)
return;
//
miu
2016/09/28 22:35:15
Done.
| |
| 244 media_stream_manager_->video_capture_manager()->PauseCaptureForClient( | 244 media_stream_manager_->video_capture_manager()->PauseCaptureForClient( |
| 245 it->second.get(), controller_id, this); | 245 it->second.get(), controller_id, this); |
| 246 Send(new VideoCaptureMsg_StateChanged(device_id, | |
| 247 VIDEO_CAPTURE_STATE_PAUSED)); | |
| 246 } | 248 } |
| 247 } | 249 } |
| 248 | 250 |
| 249 void VideoCaptureHost::OnResumeCapture( | 251 void VideoCaptureHost::OnResumeCapture( |
| 250 int device_id, | 252 int device_id, |
| 251 media::VideoCaptureSessionId session_id, | 253 media::VideoCaptureSessionId session_id, |
| 252 const media::VideoCaptureParams& params) { | 254 const media::VideoCaptureParams& params) { |
| 253 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 255 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 254 DVLOG(1) << "VideoCaptureHost::OnResumeCapture, device_id " << device_id; | 256 DVLOG(1) << "VideoCaptureHost::OnResumeCapture, device_id " << device_id; |
| 255 | 257 |
| 256 VideoCaptureControllerID controller_id(device_id); | 258 VideoCaptureControllerID controller_id(device_id); |
| 257 EntryMap::iterator it = entries_.find(controller_id); | 259 EntryMap::iterator it = entries_.find(controller_id); |
| 258 if (it == entries_.end()) | 260 if (it == entries_.end()) |
| 259 return; | 261 return; |
| 260 | 262 |
| 261 if (it->second) { | 263 if (it->second) { |
| 262 media_stream_manager_->video_capture_manager()->ResumeCaptureForClient( | 264 media_stream_manager_->video_capture_manager()->ResumeCaptureForClient( |
| 263 session_id, params, it->second.get(), controller_id, this); | 265 session_id, params, it->second.get(), controller_id, this); |
| 266 Send(new VideoCaptureMsg_StateChanged(device_id, | |
| 267 VIDEO_CAPTURE_STATE_RESUMED)); | |
| 264 } | 268 } |
| 265 } | 269 } |
| 266 | 270 |
| 267 void VideoCaptureHost::OnRequestRefreshFrame(int device_id) { | 271 void VideoCaptureHost::OnRequestRefreshFrame(int device_id) { |
| 268 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 272 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 269 DVLOG(1) << "VideoCaptureHost::OnRequestRefreshFrame, device_id " | 273 DVLOG(1) << "VideoCaptureHost::OnRequestRefreshFrame, device_id " |
| 270 << device_id; | 274 << device_id; |
| 271 | 275 |
| 272 VideoCaptureControllerID controller_id(device_id); | 276 VideoCaptureControllerID controller_id(device_id); |
| 273 EntryMap::iterator it = entries_.find(controller_id); | 277 EntryMap::iterator it = entries_.find(controller_id); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 return; | 345 return; |
| 342 | 346 |
| 343 if (it->second) { | 347 if (it->second) { |
| 344 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 348 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
| 345 it->second.get(), controller_id, this, on_error); | 349 it->second.get(), controller_id, this, on_error); |
| 346 } | 350 } |
| 347 entries_.erase(it); | 351 entries_.erase(it); |
| 348 } | 352 } |
| 349 | 353 |
| 350 } // namespace content | 354 } // namespace content |
| OLD | NEW |