| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // Sanity-checks to confirm |frame| is actually being backed by |buffer|. | 379 // Sanity-checks to confirm |frame| is actually being backed by |buffer|. |
| 380 DCHECK(frame->storage_type() == media::VideoFrame::STORAGE_SHMEM || | 380 DCHECK(frame->storage_type() == media::VideoFrame::STORAGE_SHMEM || |
| 381 (frame->storage_type() == | 381 (frame->storage_type() == |
| 382 media::VideoFrame::STORAGE_GPU_MEMORY_BUFFERS)); | 382 media::VideoFrame::STORAGE_GPU_MEMORY_BUFFERS)); |
| 383 DCHECK(frame->data(media::VideoFrame::kYPlane) >= buffer->data(0) && | 383 DCHECK(frame->data(media::VideoFrame::kYPlane) >= buffer->data(0) && |
| 384 (frame->data(media::VideoFrame::kYPlane) < | 384 (frame->data(media::VideoFrame::kYPlane) < |
| 385 (reinterpret_cast<const uint8_t*>(buffer->data(0)) + | 385 (reinterpret_cast<const uint8_t*>(buffer->data(0)) + |
| 386 buffer->mapped_size()))) | 386 buffer->mapped_size()))) |
| 387 << "VideoFrame does not appear to be backed by Buffer"; | 387 << "VideoFrame does not appear to be backed by Buffer"; |
| 388 | 388 |
| 389 for (const auto& client : controller_clients_) { | 389 for (auto* client : controller_clients_) { |
| 390 if (client->session_closed || client->paused) | 390 if (client->session_closed || client->paused) |
| 391 continue; | 391 continue; |
| 392 | 392 |
| 393 // On the first use of a buffer on a client, share the memory handles. | 393 // On the first use of a buffer on a client, share the memory handles. |
| 394 const bool is_new_buffer = client->known_buffers.insert(buffer_id).second; | 394 const bool is_new_buffer = client->known_buffers.insert(buffer_id).second; |
| 395 if (is_new_buffer) | 395 if (is_new_buffer) |
| 396 DoNewBufferOnIOThread(client, buffer.get(), frame); | 396 DoNewBufferOnIOThread(client, buffer.get(), frame); |
| 397 | 397 |
| 398 client->event_handler->OnBufferReady(client->controller_id, buffer_id, | 398 client->event_handler->OnBufferReady(client->controller_id, buffer_id, |
| 399 frame); | 399 frame); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 for (auto* client : clients) { | 499 for (auto* client : clients) { |
| 500 if (client->controller_id == id && client->event_handler == handler) | 500 if (client->controller_id == id && client->event_handler == handler) |
| 501 return client; | 501 return client; |
| 502 } | 502 } |
| 503 return NULL; | 503 return NULL; |
| 504 } | 504 } |
| 505 | 505 |
| 506 VideoCaptureController::ControllerClient* VideoCaptureController::FindClient( | 506 VideoCaptureController::ControllerClient* VideoCaptureController::FindClient( |
| 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 |