| 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/screen_capture_device_core.h" | 5 #include "media/capture/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 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 if (params.requested_format.frame_rate <= 0) { | 36 if (params.requested_format.frame_rate <= 0) { |
| 37 std::string error_msg("Invalid frame_rate: "); | 37 std::string error_msg("Invalid frame_rate: "); |
| 38 error_msg += base::DoubleToString(params.requested_format.frame_rate); | 38 error_msg += base::DoubleToString(params.requested_format.frame_rate); |
| 39 DVLOG(1) << error_msg; | 39 DVLOG(1) << error_msg; |
| 40 client->OnError(error_msg); | 40 client->OnError(error_msg); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 | 43 |
| 44 if (!(params.requested_format.pixel_format == PIXEL_FORMAT_I420 && | 44 if (params.requested_format.pixel_format != PIXEL_FORMAT_I420 && |
| 45 params.requested_format.pixel_storage == PIXEL_STORAGE_CPU) && | 45 params.requested_format.pixel_format != PIXEL_FORMAT_TEXTURE) { |
| 46 !(params.requested_format.pixel_format == PIXEL_FORMAT_ARGB && | 46 std::string error_msg = base::StringPrintf( |
| 47 params.requested_format.pixel_storage == PIXEL_STORAGE_TEXTURE)) { | 47 "unsupported format: %d", params.requested_format.pixel_format); |
| 48 const std::string error_msg = base::StringPrintf( | |
| 49 "unsupported format: %s", params.requested_format.ToString().c_str()); | |
| 50 DVLOG(1) << error_msg; | 48 DVLOG(1) << error_msg; |
| 51 client->OnError(error_msg); | 49 client->OnError(error_msg); |
| 52 return; | 50 return; |
| 53 } | 51 } |
| 54 | 52 |
| 55 if (params.requested_format.frame_size.IsEmpty()) { | 53 if (params.requested_format.frame_size.IsEmpty()) { |
| 56 const std::string error_msg = | 54 std::string error_msg = |
| 57 "invalid frame size: " + params.requested_format.frame_size.ToString(); | 55 "invalid frame size: " + params.requested_format.frame_size.ToString(); |
| 58 DVLOG(1) << error_msg; | 56 DVLOG(1) << error_msg; |
| 59 client->OnError(error_msg); | 57 client->OnError(error_msg); |
| 60 return; | 58 return; |
| 61 } | 59 } |
| 62 | 60 |
| 63 oracle_proxy_ = new ThreadSafeCaptureOracle(client.Pass(), params); | 61 oracle_proxy_ = new ThreadSafeCaptureOracle(client.Pass(), params); |
| 64 | 62 |
| 65 capture_machine_->Start( | 63 capture_machine_->Start( |
| 66 oracle_proxy_, | 64 oracle_proxy_, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return; | 129 return; |
| 132 | 130 |
| 133 if (oracle_proxy_.get()) | 131 if (oracle_proxy_.get()) |
| 134 oracle_proxy_->ReportError(reason); | 132 oracle_proxy_->ReportError(reason); |
| 135 | 133 |
| 136 StopAndDeAllocate(); | 134 StopAndDeAllocate(); |
| 137 TransitionStateTo(kError); | 135 TransitionStateTo(kError); |
| 138 } | 136 } |
| 139 | 137 |
| 140 } // namespace media | 138 } // namespace media |
| OLD | NEW |