| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/capture/content/screen_capture_device_core.h" | 5 #include "device/capture/content/screen_capture_device_core.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 | 17 |
| 18 namespace media { | 18 namespace device { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 void DeleteCaptureMachine( | 22 void DeleteCaptureMachine( |
| 23 std::unique_ptr<VideoCaptureMachine> capture_machine) { | 23 std::unique_ptr<VideoCaptureMachine> capture_machine) { |
| 24 capture_machine.reset(); | 24 capture_machine.reset(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 void ScreenCaptureDeviceCore::AllocateAndStart( | 39 void ScreenCaptureDeviceCore::AllocateAndStart( |
| 40 const VideoCaptureParams& params, | 40 const VideoCaptureParams& params, |
| 41 std::unique_ptr<VideoCaptureDevice::Client> client) { | 41 std::unique_ptr<VideoCaptureDevice::Client> client) { |
| 42 DCHECK(thread_checker_.CalledOnValidThread()); | 42 DCHECK(thread_checker_.CalledOnValidThread()); |
| 43 | 43 |
| 44 if (state_ != kIdle) { | 44 if (state_ != kIdle) { |
| 45 DVLOG(1) << "Allocate() invoked when not in state Idle."; | 45 DVLOG(1) << "Allocate() invoked when not in state Idle."; |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 | 48 |
| 49 if (params.requested_format.pixel_format != PIXEL_FORMAT_I420 || | 49 if (params.requested_format.pixel_format != media::PIXEL_FORMAT_I420 || |
| 50 params.requested_format.pixel_storage != PIXEL_STORAGE_CPU) { | 50 params.requested_format.pixel_storage != media::PIXEL_STORAGE_CPU) { |
| 51 client->OnError( | 51 client->OnError( |
| 52 FROM_HERE, | 52 FROM_HERE, |
| 53 base::StringPrintf( | 53 base::StringPrintf( |
| 54 "unsupported format: %s", | 54 "unsupported format: %s", |
| 55 VideoCaptureFormat::ToString(params.requested_format).c_str())); | 55 VideoCaptureFormat::ToString(params.requested_format).c_str())); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| 59 oracle_proxy_ = new ThreadSafeCaptureOracle( | 59 oracle_proxy_ = new ThreadSafeCaptureOracle( |
| 60 std::move(client), params, capture_machine_->IsAutoThrottlingEnabled()); | 60 std::move(client), params, capture_machine_->IsAutoThrottlingEnabled()); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (state_ == kIdle) | 134 if (state_ == kIdle) |
| 135 return; | 135 return; |
| 136 | 136 |
| 137 if (oracle_proxy_.get()) | 137 if (oracle_proxy_.get()) |
| 138 oracle_proxy_->ReportError(from_here, reason); | 138 oracle_proxy_->ReportError(from_here, reason); |
| 139 | 139 |
| 140 StopAndDeAllocate(); | 140 StopAndDeAllocate(); |
| 141 TransitionStateTo(kError); | 141 TransitionStateTo(kError); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace media | 144 } // namespace device |
| OLD | NEW |