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

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

Issue 1191443003: VideoCaptureParams: add flag for hinting capture using GpuMemoryBuffers & flag for it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added #include "build/build_config.h" 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 client->event_handler->OnBufferReady( 341 client->event_handler->OnBufferReady(
342 client->controller_id, buffer_id, frame->coded_size(), 342 client->controller_id, buffer_id, frame->coded_size(),
343 frame->visible_rect(), timestamp, copy_of_metadata.Pass()); 343 frame->visible_rect(), timestamp, copy_of_metadata.Pass());
344 } else { 344 } else {
345 // VideoFrame format not supported. 345 // VideoFrame format not supported.
346 NOTREACHED() << media::VideoFrame::FormatToString(frame->format()); 346 NOTREACHED() << media::VideoFrame::FormatToString(frame->format());
347 break; 347 break;
348 } 348 }
349 349
350 bool inserted = 350 const bool inserted =
351 client->active_buffers.insert(std::make_pair(buffer_id, frame)) 351 client->active_buffers.insert(std::make_pair(buffer_id, frame))
352 .second; 352 .second;
353 DCHECK(inserted) << "Unexpected duplicate buffer: " << buffer_id; 353 DCHECK(inserted) << "Unexpected duplicate buffer: " << buffer_id;
354 count++; 354 count++;
355 } 355 }
356 } 356 }
357 357
358 if (!has_received_frames_) { 358 if (!has_received_frames_) {
359 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Width", 359 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Width",
360 frame->visible_rect().width()); 360 frame->visible_rect().width());
361 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Height", 361 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Height",
362 frame->visible_rect().height()); 362 frame->visible_rect().height());
363 UMA_HISTOGRAM_ASPECT_RATIO("Media.VideoCapture.AspectRatio", 363 UMA_HISTOGRAM_ASPECT_RATIO("Media.VideoCapture.AspectRatio",
364 frame->visible_rect().width(), 364 frame->visible_rect().width(),
365 frame->visible_rect().height()); 365 frame->visible_rect().height());
366 double frame_rate; 366 double frame_rate = 0.0f;
367 if (!frame->metadata()->GetDouble(media::VideoFrameMetadata::FRAME_RATE, 367 if (!frame->metadata()->GetDouble(media::VideoFrameMetadata::FRAME_RATE,
368 &frame_rate)) 368 &frame_rate)) {
369 frame_rate = video_capture_format_.frame_rate; 369 frame_rate = video_capture_format_.frame_rate;
370 }
370 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate", frame_rate); 371 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate", frame_rate);
371 has_received_frames_ = true; 372 has_received_frames_ = true;
372 } 373 }
373 374
374 buffer_pool_->HoldForConsumers(buffer_id, count); 375 buffer_pool_->HoldForConsumers(buffer_id, count);
375 } 376 }
376 377
377 void VideoCaptureController::DoErrorOnIOThread() { 378 void VideoCaptureController::DoErrorOnIOThread() {
378 DCHECK_CURRENTLY_ON(BrowserThread::IO); 379 DCHECK_CURRENTLY_ON(BrowserThread::IO);
379 state_ = VIDEO_CAPTURE_STATE_ERROR; 380 state_ = VIDEO_CAPTURE_STATE_ERROR;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 DCHECK_CURRENTLY_ON(BrowserThread::IO); 436 DCHECK_CURRENTLY_ON(BrowserThread::IO);
436 int active_client_count = 0; 437 int active_client_count = 0;
437 for (ControllerClient* client : controller_clients_) { 438 for (ControllerClient* client : controller_clients_) {
438 if (!client->paused) 439 if (!client->paused)
439 ++active_client_count; 440 ++active_client_count;
440 } 441 }
441 return active_client_count; 442 return active_client_count;
442 } 443 }
443 444
444 } // namespace content 445 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698