Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_controller.cc |
| diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc |
| index e277fe727966e43401fcdd7353d169f81465c337..6f645878bb5023d33943f63435593915ed82f905 100644 |
| --- a/content/browser/renderer_host/media/video_capture_controller.cc |
| +++ b/content/browser/renderer_host/media/video_capture_controller.cc |
| @@ -178,20 +178,19 @@ class VideoCaptureController::VideoCaptureDeviceClient |
| // The pool of shared-memory buffers used for capturing. |
| const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
| - |
| - bool first_frame_; |
| }; |
| VideoCaptureController::VideoCaptureController(int max_buffers) |
| : buffer_pool_(new VideoCaptureBufferPool(max_buffers)), |
| state_(VIDEO_CAPTURE_STATE_STARTED), |
| + frame_received_(false), |
| weak_ptr_factory_(this) { |
| } |
| VideoCaptureController::VideoCaptureDeviceClient::VideoCaptureDeviceClient( |
| const base::WeakPtr<VideoCaptureController>& controller, |
| const scoped_refptr<VideoCaptureBufferPool>& buffer_pool) |
| - : controller_(controller), buffer_pool_(buffer_pool), first_frame_(true) {} |
| + : controller_(controller), buffer_pool_(buffer_pool) {} |
| VideoCaptureController::VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {} |
| @@ -478,22 +477,6 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedData( |
| format, |
| frame, |
| timestamp)); |
| - |
| - if (first_frame_) { |
| - UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Width", |
| - frame_format.frame_size.width()); |
| - UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Height", |
| - frame_format.frame_size.height()); |
| - UMA_HISTOGRAM_ASPECT_RATIO("Media.VideoCapture.AspectRatio", |
| - frame_format.frame_size.width(), |
| - frame_format.frame_size.height()); |
| - UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate", |
| - frame_format.frame_rate); |
| - UMA_HISTOGRAM_ENUMERATION("Media.VideoCapture.PixelFormat", |
| - frame_format.pixel_format, |
| - media::PIXEL_FORMAT_MAX); |
| - first_frame_ = false; |
| - } |
| } |
| void |
| @@ -568,6 +551,7 @@ VideoCaptureController::VideoCaptureDeviceClient::DoReserveOutputBuffer( |
| VideoCaptureController::~VideoCaptureController() { |
| STLDeleteContainerPointers(controller_clients_.begin(), |
| controller_clients_.end()); |
| + UMA_HISTOGRAM_BOOLEAN("Media.VideoCapture.FramesReceived", frame_received_); |
|
Henrik Grunell
2014/09/02 06:36:23
Is there cases where we won't destruct this? How o
perkj_chrome
2014/09/02 08:30:28
To my knowledge, this object is destroyed when the
Henrik Grunell
2014/09/02 08:36:44
OK, we'll keep this in mind when interpreting the
|
| } |
| void VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread( |
| @@ -616,6 +600,22 @@ void VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread( |
| } |
| } |
| + if (!frame_received_) { |
| + UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Width", |
| + buffer_format.frame_size.width()); |
| + UMA_HISTOGRAM_COUNTS("Media.VideoCapture.Height", |
| + buffer_format.frame_size.height()); |
| + UMA_HISTOGRAM_ASPECT_RATIO("Media.VideoCapture.AspectRatio", |
| + buffer_format.frame_size.width(), |
| + buffer_format.frame_size.height()); |
| + UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate", |
| + buffer_format.frame_rate); |
| + UMA_HISTOGRAM_ENUMERATION("Media.VideoCapture.PixelFormat", |
| + buffer_format.pixel_format, |
| + media::PIXEL_FORMAT_MAX); |
| + frame_received_ = true; |
| + } |
| + |
| buffer_pool_->HoldForConsumers(buffer->id(), count); |
| } |