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

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

Issue 1204063005: Reland: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheng@ nit on DCHECK_EQ(expected, actual) Created 5 years, 5 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698