Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 1179323002: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: second round of comments from hubbe@. Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 copy_of_metadata.reset(metadata->DeepCopy()); 321 copy_of_metadata.reset(metadata->DeepCopy());
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 client->event_handler->OnMailboxBufferReady( 327 client->event_handler->OnMailboxBufferReady(
328 client->controller_id, buffer_id, frame->mailbox_holder(0), 328 client->controller_id, buffer_id, frame->mailbox_holder(0),
329 frame->coded_size(), timestamp, copy_of_metadata.Pass()); 329 frame->coded_size(), timestamp, copy_of_metadata.Pass());
330 } else if (frame->format() == media::VideoFrame::I420) { 330 } else if (frame->format() == media::VideoFrame::I420) {
331 bool is_new_buffer = client->known_buffers.insert(buffer_id).second; 331 DCHECK(frame->IsMappable());
332 const bool is_new_buffer =
333 client->known_buffers.insert(buffer_id).second;
332 if (is_new_buffer) { 334 if (is_new_buffer) {
333 // On the first use of a buffer on a client, share the memory handle. 335 // On the first use of a buffer on a client, share the memory handle.
334 size_t memory_size = 0; 336 size_t memory_size = 0;
335 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess( 337 base::SharedMemoryHandle remote_handle = buffer_pool_->ShareToProcess(
336 buffer_id, client->render_process_handle, &memory_size); 338 buffer_id, client->render_process_handle, &memory_size);
337 client->event_handler->OnBufferCreated( 339 client->event_handler->OnBufferCreated(
338 client->controller_id, remote_handle, memory_size, buffer_id); 340 client->controller_id, remote_handle, memory_size, buffer_id);
339 } 341 }
340 342
341 client->event_handler->OnBufferReady( 343 client->event_handler->OnBufferReady(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 DCHECK_CURRENTLY_ON(BrowserThread::IO); 438 DCHECK_CURRENTLY_ON(BrowserThread::IO);
437 int active_client_count = 0; 439 int active_client_count = 0;
438 for (ControllerClient* client : controller_clients_) { 440 for (ControllerClient* client : controller_clients_) {
439 if (!client->paused) 441 if (!client->paused)
440 ++active_client_count; 442 ++active_client_count;
441 } 443 }
442 return active_client_count; 444 return active_client_count;
443 } 445 }
444 446
445 } // namespace content 447 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698