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