OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/in_process_video_capture_device_la
uncher.h" | 5 #include "content/browser/renderer_host/media/in_process_video_capture_device_la
uncher.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" | 9 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" |
10 #include "content/browser/media/capture/web_contents_video_capture_device.h" | 10 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 77 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
78 DCHECK(state_ == State::READY_TO_LAUNCH); | 78 DCHECK(state_ == State::READY_TO_LAUNCH); |
79 | 79 |
80 const int max_buffers = | 80 const int max_buffers = |
81 (stream_type == MEDIA_TAB_VIDEO_CAPTURE ? kMaxNumberOfBuffersForTabCapture | 81 (stream_type == MEDIA_TAB_VIDEO_CAPTURE ? kMaxNumberOfBuffersForTabCapture |
82 : kMaxNumberOfBuffers); | 82 : kMaxNumberOfBuffers); |
83 | 83 |
84 auto device_client = CreateDeviceClient(max_buffers, std::move(receiver)); | 84 auto device_client = CreateDeviceClient(max_buffers, std::move(receiver)); |
85 | 85 |
86 base::Closure start_capture_closure; | 86 base::Closure start_capture_closure; |
87 // Use of |this| is safe, because |done_cb| guarantees that |this| | 87 // Use of Unretained |this| is safe, because |done_cb| guarantees that |this| |
88 // stays alive. | 88 // stays alive. |
89 ReceiveDeviceCallback after_start_capture_callback = media::BindToCurrentLoop( | 89 ReceiveDeviceCallback after_start_capture_callback = media::BindToCurrentLoop( |
90 base::Bind(&InProcessVideoCaptureDeviceLauncher::OnDeviceStarted, | 90 base::Bind(&InProcessVideoCaptureDeviceLauncher::OnDeviceStarted, |
91 base::Unretained(this), callbacks, base::Passed(&done_cb))); | 91 base::Unretained(this), callbacks, base::Passed(&done_cb))); |
92 | 92 |
93 switch (stream_type) { | 93 switch (stream_type) { |
94 case MEDIA_DEVICE_VIDEO_CAPTURE: { | 94 case MEDIA_DEVICE_VIDEO_CAPTURE: { |
95 start_capture_closure = | 95 start_capture_closure = |
96 base::Bind(&InProcessVideoCaptureDeviceLauncher:: | 96 base::Bind(&InProcessVideoCaptureDeviceLauncher:: |
97 DoStartDeviceCaptureOnDeviceThread, | 97 DoStartDeviceCaptureOnDeviceThread, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 if (!video_capture_device) { | 280 if (!video_capture_device) { |
281 result_callback.Run(nullptr); | 281 result_callback.Run(nullptr); |
282 return; | 282 return; |
283 } | 283 } |
284 | 284 |
285 video_capture_device->AllocateAndStart(params, std::move(device_client)); | 285 video_capture_device->AllocateAndStart(params, std::move(device_client)); |
286 result_callback.Run(std::move(video_capture_device)); | 286 result_callback.Run(std::move(video_capture_device)); |
287 } | 287 } |
288 | 288 |
289 } // namespace content | 289 } // namespace content |
OLD | NEW |