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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 75 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
76 DCHECK(state_ == State::READY_TO_LAUNCH); | 76 DCHECK(state_ == State::READY_TO_LAUNCH); |
77 | 77 |
78 const int max_buffers = | 78 const int max_buffers = |
79 (stream_type == MEDIA_TAB_VIDEO_CAPTURE ? kMaxNumberOfBuffersForTabCapture | 79 (stream_type == MEDIA_TAB_VIDEO_CAPTURE ? kMaxNumberOfBuffersForTabCapture |
80 : kMaxNumberOfBuffers); | 80 : kMaxNumberOfBuffers); |
81 | 81 |
82 auto device_client = CreateDeviceClient(max_buffers, std::move(receiver)); | 82 auto device_client = CreateDeviceClient(max_buffers, std::move(receiver)); |
83 | 83 |
84 base::Closure start_capture_closure; | 84 base::Closure start_capture_closure; |
85 // Use of |this| is safe, because |done_cb| guarantees that |this| | 85 // Use of Unretained |this| is safe, because |done_cb| guarantees that |this| |
86 // stays alive. | 86 // stays alive. |
87 ReceiveDeviceCallback after_start_capture_callback = media::BindToCurrentLoop( | 87 ReceiveDeviceCallback after_start_capture_callback = media::BindToCurrentLoop( |
88 base::Bind(&InProcessVideoCaptureDeviceLauncher::OnDeviceStarted, | 88 base::Bind(&InProcessVideoCaptureDeviceLauncher::OnDeviceStarted, |
89 base::Unretained(this), callbacks, base::Passed(&done_cb))); | 89 base::Unretained(this), callbacks, base::Passed(&done_cb))); |
90 | 90 |
91 switch (stream_type) { | 91 switch (stream_type) { |
92 case MEDIA_DEVICE_VIDEO_CAPTURE: { | 92 case MEDIA_DEVICE_VIDEO_CAPTURE: { |
93 start_capture_closure = | 93 start_capture_closure = |
94 base::Bind(&InProcessVideoCaptureDeviceLauncher:: | 94 base::Bind(&InProcessVideoCaptureDeviceLauncher:: |
95 DoStartDeviceCaptureOnDeviceThread, | 95 DoStartDeviceCaptureOnDeviceThread, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 if (!video_capture_device) { | 277 if (!video_capture_device) { |
278 result_callback.Run(nullptr); | 278 result_callback.Run(nullptr); |
279 return; | 279 return; |
280 } | 280 } |
281 | 281 |
282 video_capture_device->AllocateAndStart(params, std::move(device_client)); | 282 video_capture_device->AllocateAndStart(params, std::move(device_client)); |
283 result_callback.Run(std::move(video_capture_device)); | 283 result_callback.Run(std::move(video_capture_device)); |
284 } | 284 } |
285 | 285 |
286 } // namespace content | 286 } // namespace content |
OLD | NEW |