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 | |
328 } else if (frame->format() == VideoFrame::I420) { | 327 } else if (frame->format() == VideoFrame::I420) { |
329 const bool is_new_buffer = | 328 const bool is_new_buffer = |
330 client->known_buffers.insert(buffer_id).second; | 329 client->known_buffers.insert(buffer_id).second; |
331 if (is_new_buffer) { | 330 if (is_new_buffer) { |
332 // On the first use of a buffer on a client, share the memory handle. | 331 // On the first use of a buffer on a client, share the memory handle. |
333 size_t memory_size = 0; | 332 size_t memory_size = 0; |
334 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( | 333 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( |
335 buffer_id, client->render_process_handle, &memory_size); | 334 buffer_id, client->render_process_handle, &memory_size); |
336 client->event_handler->OnBufferCreated( | 335 client->event_handler->OnBufferCreated( |
337 client->controller_id, remote_handle, memory_size, buffer_id); | 336 client->controller_id, remote_handle, memory_size, buffer_id); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 430 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
432 int active_client_count = 0; | 431 int active_client_count = 0; |
433 for (ControllerClient* client : controller_clients_) { | 432 for (ControllerClient* client : controller_clients_) { |
434 if (!client->paused) | 433 if (!client->paused) |
435 ++active_client_count; | 434 ++active_client_count; |
436 } | 435 } |
437 return active_client_count; | 436 return active_client_count; |
438 } | 437 } |
439 | 438 |
440 } // namespace content | 439 } // namespace content |
OLD | NEW |