| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 media::PIXEL_STORAGE_GPUMEMORYBUFFER)) { | 172 media::PIXEL_STORAGE_GPUMEMORYBUFFER)) { |
| 173 // Crash in debug builds since the renderer should not have asked for | 173 // Crash in debug builds since the renderer should not have asked for |
| 174 // invalid or unsupported parameters. | 174 // invalid or unsupported parameters. |
| 175 LOG(DFATAL) << "Invalid or unsupported video capture parameters requested: " | 175 LOG(DFATAL) << "Invalid or unsupported video capture parameters requested: " |
| 176 << media::VideoCaptureFormat::ToString(params.requested_format); | 176 << media::VideoCaptureFormat::ToString(params.requested_format); |
| 177 event_handler->OnError(id); | 177 event_handler->OnError(id); |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 | 180 |
| 181 // If this is the first client added to the controller, cache the parameters. | 181 // If this is the first client added to the controller, cache the parameters. |
| 182 if (!controller_clients_.size()) | 182 if (controller_clients_.empty()) |
| 183 video_capture_format_ = params.requested_format; | 183 video_capture_format_ = params.requested_format; |
| 184 | 184 |
| 185 // Signal error in case device is already in error state. | 185 // Signal error in case device is already in error state. |
| 186 if (state_ == VIDEO_CAPTURE_STATE_ERROR) { | 186 if (state_ == VIDEO_CAPTURE_STATE_ERROR) { |
| 187 event_handler->OnError(id); | 187 event_handler->OnError(id); |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 | 190 |
| 191 // Do nothing if this client has called AddClient before. | 191 // Do nothing if this client has called AddClient before. |
| 192 if (FindClient(id, event_handler, controller_clients_)) | 192 if (FindClient(id, event_handler, controller_clients_)) |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 int session_id, | 507 int session_id, |
| 508 const ControllerClients& clients) { | 508 const ControllerClients& clients) { |
| 509 for (auto client : clients) { | 509 for (auto client : clients) { |
| 510 if (client->session_id == session_id) | 510 if (client->session_id == session_id) |
| 511 return client; | 511 return client; |
| 512 } | 512 } |
| 513 return NULL; | 513 return NULL; |
| 514 } | 514 } |
| 515 | 515 |
| 516 } // namespace content | 516 } // namespace content |
| OLD | NEW |