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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 CHECK((frame->IsMappable() && frame->format() == VideoFrame::I420) || | 317 CHECK((frame->IsMappable() && frame->format() == VideoFrame::I420) || |
318 (!frame->IsMappable() && frame->HasTextures() && | 318 (!frame->IsMappable() && frame->HasTextures() && |
319 frame->format() == VideoFrame::ARGB)) | 319 frame->format() == VideoFrame::ARGB)) |
320 << "Format and/or storage type combination not supported (received: " | 320 << "Format and/or storage type combination not supported (received: " |
321 << VideoFrame::FormatToString(frame->format()) << ")"; | 321 << VideoFrame::FormatToString(frame->format()) << ")"; |
322 | 322 |
323 if (frame->HasTextures()) { | 323 if (frame->HasTextures()) { |
324 DCHECK(frame->coded_size() == frame->visible_rect().size()) | 324 DCHECK(frame->coded_size() == frame->visible_rect().size()) |
325 << "Textures are always supposed to be tightly packed."; | 325 << "Textures are always supposed to be tightly packed."; |
326 DCHECK_EQ(1u, VideoFrame::NumPlanes(frame->format())); | 326 DCHECK_EQ(1u, VideoFrame::NumPlanes(frame->format())); |
| 327 |
327 } else if (frame->format() == VideoFrame::I420) { | 328 } else if (frame->format() == VideoFrame::I420) { |
328 const bool is_new_buffer = | 329 const bool is_new_buffer = |
329 client->known_buffers.insert(buffer_id).second; | 330 client->known_buffers.insert(buffer_id).second; |
330 if (is_new_buffer) { | 331 if (is_new_buffer) { |
331 // On the first use of a buffer on a client, share the memory handle. | 332 // On the first use of a buffer on a client, share the memory handle. |
332 size_t memory_size = 0; | 333 size_t memory_size = 0; |
333 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( | 334 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( |
334 buffer_id, client->render_process_handle, &memory_size); | 335 buffer_id, client->render_process_handle, &memory_size); |
335 client->event_handler->OnBufferCreated( | 336 client->event_handler->OnBufferCreated( |
336 client->controller_id, remote_handle, memory_size, buffer_id); | 337 client->controller_id, remote_handle, memory_size, buffer_id); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 431 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
431 int active_client_count = 0; | 432 int active_client_count = 0; |
432 for (ControllerClient* client : controller_clients_) { | 433 for (ControllerClient* client : controller_clients_) { |
433 if (!client->paused) | 434 if (!client->paused) |
434 ++active_client_count; | 435 ++active_client_count; |
435 } | 436 } |
436 return active_client_count; | 437 return active_client_count; |
437 } | 438 } |
438 | 439 |
439 } // namespace content | 440 } // namespace content |
OLD | NEW |