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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 scoped_ptr<base::DictionaryValue> copy_of_metadata; | 295 scoped_ptr<base::DictionaryValue> copy_of_metadata; |
296 if (client == controller_clients_.back()) | 296 if (client == controller_clients_.back()) |
297 copy_of_metadata = metadata.Pass(); | 297 copy_of_metadata = metadata.Pass(); |
298 else | 298 else |
299 copy_of_metadata.reset(metadata->DeepCopy()); | 299 copy_of_metadata.reset(metadata->DeepCopy()); |
300 | 300 |
301 if (frame->format() == VideoFrame::NATIVE_TEXTURE) { | 301 if (frame->format() == VideoFrame::NATIVE_TEXTURE) { |
302 DCHECK(frame->coded_size() == frame->visible_rect().size()) | 302 DCHECK(frame->coded_size() == frame->visible_rect().size()) |
303 << "Textures are always supposed to be tightly packed."; | 303 << "Textures are always supposed to be tightly packed."; |
304 client->event_handler->OnMailboxBufferReady(client->controller_id, | 304 DCHECK_EQ(1u, VideoFrame::NumTextures(frame->texture_format())); |
305 buffer_id, | 305 client->event_handler->OnMailboxBufferReady( |
306 *frame->mailbox_holder(), | 306 client->controller_id, buffer_id, frame->mailbox_holder(0), |
307 frame->coded_size(), | 307 frame->coded_size(), timestamp, copy_of_metadata.Pass()); |
308 timestamp, | |
309 copy_of_metadata.Pass()); | |
310 } else if (frame->format() == media::VideoFrame::I420) { | 308 } else if (frame->format() == media::VideoFrame::I420) { |
311 bool is_new_buffer = client->known_buffers.insert(buffer_id).second; | 309 bool is_new_buffer = client->known_buffers.insert(buffer_id).second; |
312 if (is_new_buffer) { | 310 if (is_new_buffer) { |
313 // On the first use of a buffer on a client, share the memory handle. | 311 // On the first use of a buffer on a client, share the memory handle. |
314 size_t memory_size = 0; | 312 size_t memory_size = 0; |
315 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( | 313 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( |
316 buffer_id, client->render_process_handle, &memory_size); | 314 buffer_id, client->render_process_handle, &memory_size); |
317 client->event_handler->OnBufferCreated( | 315 client->event_handler->OnBufferCreated( |
318 client->controller_id, remote_handle, memory_size, buffer_id); | 316 client->controller_id, remote_handle, memory_size, buffer_id); |
319 } | 317 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 413 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
416 int active_client_count = 0; | 414 int active_client_count = 0; |
417 for (ControllerClient* client : controller_clients_) { | 415 for (ControllerClient* client : controller_clients_) { |
418 if (!client->paused) | 416 if (!client->paused) |
419 ++active_client_count; | 417 ++active_client_count; |
420 } | 418 } |
421 return active_client_count; | 419 return active_client_count; |
422 } | 420 } |
423 | 421 |
424 } // namespace content | 422 } // namespace content |
OLD | NEW |