Commit 0201e3f2 authored by perkj's avatar perkj Committed by Commit bot

Move UMA Media.VideoTrackAdapter.FramesReceived to VideoCaptureController.

Before this cl, VideoTrackAdapter.FramesReceived was logged for all types of MediaStreamVideoSources including remote video sources and pepper api sources.
The indent of this UMA stat is to track if a video capture device output video frames or not.

BUG= 409624

Review URL: https://codereview.chromium.org/529733002

Cr-Commit-Position: refs/heads/master@{#293460}
parent 664a17fe
...@@ -179,20 +179,19 @@ class VideoCaptureController::VideoCaptureDeviceClient ...@@ -179,20 +179,19 @@ class VideoCaptureController::VideoCaptureDeviceClient
// The pool of shared-memory buffers used for capturing. // The pool of shared-memory buffers used for capturing.
const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; const scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
bool first_frame_;
}; };
VideoCaptureController::VideoCaptureController(int max_buffers) VideoCaptureController::VideoCaptureController(int max_buffers)
: buffer_pool_(new VideoCaptureBufferPool(max_buffers)), : buffer_pool_(new VideoCaptureBufferPool(max_buffers)),
state_(VIDEO_CAPTURE_STATE_STARTED), state_(VIDEO_CAPTURE_STATE_STARTED),
frame_received_(false),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
} }
VideoCaptureController::VideoCaptureDeviceClient::VideoCaptureDeviceClient( VideoCaptureController::VideoCaptureDeviceClient::VideoCaptureDeviceClient(
const base::WeakPtr<VideoCaptureController>& controller, const base::WeakPtr<VideoCaptureController>& controller,
const scoped_refptr<VideoCaptureBufferPool>& buffer_pool) const scoped_refptr<VideoCaptureBufferPool>& buffer_pool)
: controller_(controller), buffer_pool_(buffer_pool), first_frame_(true) {} : controller_(controller), buffer_pool_(buffer_pool) {}
VideoCaptureController::VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {} VideoCaptureController::VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {}
...@@ -479,22 +478,6 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedData( ...@@ -479,22 +478,6 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedData(
format, format,
frame, frame,
timestamp)); 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 void
...@@ -574,6 +557,7 @@ VideoCaptureController::VideoCaptureDeviceClient::DoReserveOutputBuffer( ...@@ -574,6 +557,7 @@ VideoCaptureController::VideoCaptureDeviceClient::DoReserveOutputBuffer(
VideoCaptureController::~VideoCaptureController() { VideoCaptureController::~VideoCaptureController() {
STLDeleteContainerPointers(controller_clients_.begin(), STLDeleteContainerPointers(controller_clients_.begin(),
controller_clients_.end()); controller_clients_.end());
UMA_HISTOGRAM_BOOLEAN("Media.VideoCapture.FramesReceived", frame_received_);
} }
void VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread( void VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread(
...@@ -622,6 +606,22 @@ void VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread( ...@@ -622,6 +606,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); buffer_pool_->HoldForConsumers(buffer->id(), count);
} }
......
...@@ -151,6 +151,9 @@ class CONTENT_EXPORT VideoCaptureController { ...@@ -151,6 +151,9 @@ class CONTENT_EXPORT VideoCaptureController {
// state which stops the flow of data to clients. // state which stops the flow of data to clients.
VideoCaptureState state_; VideoCaptureState state_;
// True if the controller has received a video frame from the device.
bool frame_received_;
media::VideoCaptureFormat video_capture_format_; media::VideoCaptureFormat video_capture_format_;
base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_;
......
...@@ -345,8 +345,6 @@ VideoTrackAdapter::VideoTrackAdapter( ...@@ -345,8 +345,6 @@ VideoTrackAdapter::VideoTrackAdapter(
VideoTrackAdapter::~VideoTrackAdapter() { VideoTrackAdapter::~VideoTrackAdapter() {
DCHECK(adapters_.empty()); DCHECK(adapters_.empty());
UMA_HISTOGRAM_BOOLEAN("Media.VideoTrackAdapter.FramesReceived",
frame_counter_ > 0);
} }
void VideoTrackAdapter::AddTrack( void VideoTrackAdapter::AddTrack(
......
...@@ -11696,6 +11696,15 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -11696,6 +11696,15 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary> </summary>
</histogram> </histogram>
<histogram name="Media.VideoCapture.FramesReceived" enum="BooleanReceived">
<owner>grunell@chromium.org</owner>
<owner>mcasas@chromium.org</owner>
<summary>
Whether any frames were received during a video capture session. This metric
is recorded when a video source is stopped.
</summary>
</histogram>
<histogram name="Media.VideoCapture.Height" units="pixels"> <histogram name="Media.VideoCapture.Height" units="pixels">
<owner>mcasas@chromium.org</owner> <owner>mcasas@chromium.org</owner>
<summary> <summary>
...@@ -11769,6 +11778,9 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -11769,6 +11778,9 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</histogram> </histogram>
<histogram name="Media.VideoTrackAdapter.FramesReceived" enum="BooleanReceived"> <histogram name="Media.VideoTrackAdapter.FramesReceived" enum="BooleanReceived">
<obsolete>
Replaced by Media.VideoCapture.FramesReceived 09/2014.
</obsolete>
<owner>grunell@chromium.org</owner> <owner>grunell@chromium.org</owner>
<owner>mcasas@chromium.org</owner> <owner>mcasas@chromium.org</owner>
<summary> <summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment