| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 for (const auto& client : controller_clients_) { | 291 for (const auto& client : controller_clients_) { |
| 292 if (client->session_closed || client->paused) | 292 if (client->session_closed || client->paused) |
| 293 continue; | 293 continue; |
| 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->storage_type() == VideoFrame::STORAGE_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 DCHECK_EQ(1u, VideoFrame::NumTextures(frame->texture_format())); | 304 DCHECK_EQ(1u, VideoFrame::NumPlanes(frame->format())); |
| 305 client->event_handler->OnMailboxBufferReady( | 305 client->event_handler->OnMailboxBufferReady( |
| 306 client->controller_id, buffer_id, frame->mailbox_holder(0), | 306 client->controller_id, buffer_id, frame->mailbox_holder(0), |
| 307 frame->coded_size(), timestamp, copy_of_metadata.Pass()); | 307 frame->coded_size(), timestamp, copy_of_metadata.Pass()); |
| 308 } else if (frame->format() == media::VideoFrame::I420) { | 308 } else if (frame->format() == media::VideoFrame::I420) { |
| 309 bool is_new_buffer = client->known_buffers.insert(buffer_id).second; | 309 bool is_new_buffer = client->known_buffers.insert(buffer_id).second; |
| 310 if (is_new_buffer) { | 310 if (is_new_buffer) { |
| 311 // 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. |
| 312 size_t memory_size = 0; | 312 size_t memory_size = 0; |
| 313 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( | 313 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( |
| 314 buffer_id, client->render_process_handle, &memory_size); | 314 buffer_id, client->render_process_handle, &memory_size); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 413 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 414 int active_client_count = 0; | 414 int active_client_count = 0; |
| 415 for (ControllerClient* client : controller_clients_) { | 415 for (ControllerClient* client : controller_clients_) { |
| 416 if (!client->paused) | 416 if (!client->paused) |
| 417 ++active_client_count; | 417 ++active_client_count; |
| 418 } | 418 } |
| 419 return active_client_count; | 419 return active_client_count; |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace content | 422 } // namespace content |
| OLD | NEW |