| 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 "media/capture/content/screen_capture_device_core.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 void ScreenCaptureDeviceCore::AllocateAndStart( | 35 void ScreenCaptureDeviceCore::AllocateAndStart( |
| 36 const VideoCaptureParams& params, | 36 const VideoCaptureParams& params, |
| 37 scoped_ptr<VideoCaptureDevice::Client> client) { | 37 scoped_ptr<VideoCaptureDevice::Client> client) { |
| 38 DCHECK(thread_checker_.CalledOnValidThread()); | 38 DCHECK(thread_checker_.CalledOnValidThread()); |
| 39 | 39 |
| 40 if (state_ != kIdle) { | 40 if (state_ != kIdle) { |
| 41 DVLOG(1) << "Allocate() invoked when not in state Idle."; | 41 DVLOG(1) << "Allocate() invoked when not in state Idle."; |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 if (!(params.requested_format.pixel_format == PIXEL_FORMAT_I420 && | 45 if (params.requested_format.pixel_format != PIXEL_FORMAT_I420 || |
| 46 params.requested_format.pixel_storage == PIXEL_STORAGE_CPU) && | 46 params.requested_format.pixel_storage != PIXEL_STORAGE_CPU) { |
| 47 !(params.requested_format.pixel_format == PIXEL_FORMAT_ARGB && | |
| 48 params.requested_format.pixel_storage == PIXEL_STORAGE_TEXTURE)) { | |
| 49 client->OnError( | 47 client->OnError( |
| 50 FROM_HERE, | 48 FROM_HERE, |
| 51 base::StringPrintf( | 49 base::StringPrintf( |
| 52 "unsupported format: %s", | 50 "unsupported format: %s", |
| 53 VideoCaptureFormat::ToString(params.requested_format).c_str())); | 51 VideoCaptureFormat::ToString(params.requested_format).c_str())); |
| 54 return; | 52 return; |
| 55 } | 53 } |
| 56 | 54 |
| 57 oracle_proxy_ = new ThreadSafeCaptureOracle( | 55 oracle_proxy_ = new ThreadSafeCaptureOracle( |
| 58 client.Pass(), params, capture_machine_->IsAutoThrottlingEnabled()); | 56 client.Pass(), params, capture_machine_->IsAutoThrottlingEnabled()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return; | 120 return; |
| 123 | 121 |
| 124 if (oracle_proxy_.get()) | 122 if (oracle_proxy_.get()) |
| 125 oracle_proxy_->ReportError(from_here, reason); | 123 oracle_proxy_->ReportError(from_here, reason); |
| 126 | 124 |
| 127 StopAndDeAllocate(); | 125 StopAndDeAllocate(); |
| 128 TransitionStateTo(kError); | 126 TransitionStateTo(kError); |
| 129 } | 127 } |
| 130 | 128 |
| 131 } // namespace media | 129 } // namespace media |
| OLD | NEW |