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

Unified Diff: media/base/android/media_statistics.cc

Issue 2283493003: Delete browser MSE implementation. (Closed)
Patch Set: Actually delete MSP. Cleanse references. Remove AudioTrack usage. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_statistics.cc
diff --git a/media/base/android/media_statistics.cc b/media/base/android/media_statistics.cc
deleted file mode 100644
index e141bbbc5839564c462a555b7cbe7bf4e79956a4..0000000000000000000000000000000000000000
--- a/media/base/android/media_statistics.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/base/android/media_statistics.h"
-
-#include "base/logging.h"
-#include "base/metrics/histogram_macros.h"
-#include "media/base/android/demuxer_stream_player_params.h"
-
-namespace media {
-
-// Minimum playback interval to report.
-const int kMinDurationInSeconds = 2;
-
-// Maximum playback interval to report.
-const int kMaxDurationInSeconds = 3600;
-
-// Number of slots in the histogram for playback interval.
-const int kNumDurationSlots = 50;
-
-// For easier reading.
-const int kOneMillion = 1000000;
-
-void FrameStatistics::IncrementLateFrameCount() {
- // Do not collect the late frame if this is the first frame after the start.
- // Right now we do not want to consider the late video frame which is the
- // first after preroll, preroll may be inacurate in this respect.
- // The first audio frame cannot be late by definition and by not considering
- // it we can simplify audio decoder code.
- if (total == 1)
- return;
-
- ++late;
-}
-
-MediaStatistics::MediaStatistics() {}
-
-MediaStatistics::~MediaStatistics() {}
-
-void MediaStatistics::Start(base::TimeDelta current_playback_time) {
- DVLOG(1) << __FUNCTION__;
-
- if (start_time_ == kNoTimestamp) {
- Clear();
- start_time_ = current_playback_time;
- }
-}
-
-void MediaStatistics::StopAndReport(base::TimeDelta current_playback_time) {
- DVLOG(1) << __FUNCTION__;
-
- if (start_time_ == kNoTimestamp)
- return; // skip if there was no prior Start().
-
- if (current_playback_time == kNoTimestamp) {
- // Cancel the start event and skip if current time is unknown.
- start_time_ = kNoTimestamp;
- return;
- }
-
- base::TimeDelta duration = current_playback_time - start_time_;
-
- // Reset start time.
- start_time_ = kNoTimestamp;
-
- if (duration < base::TimeDelta::FromSeconds(kMinDurationInSeconds))
- return; // duration is too short.
-
- if (duration > base::TimeDelta::FromSeconds(kMaxDurationInSeconds))
- return; // duration is too long.
-
- Report(duration);
-}
-
-void MediaStatistics::Clear() {
- start_time_ = kNoTimestamp;
- audio_frame_stats_.Clear();
- video_frame_stats_.Clear();
- num_starvations_ = 0;
-}
-
-void MediaStatistics::Report(base::TimeDelta duration) {
- DVLOG(1) << __FUNCTION__ << " duration:" << duration
- << " audio frames:"
- << audio_frame_stats_.late << "/" << audio_frame_stats_.total
- << " video frames:"
- << video_frame_stats_.late << "/" << video_frame_stats_.total
- << " starvations:" << num_starvations_;
-
- // Playback duration is the time interval between the moment playback starts
- // and the moment it is interrupted either by stopping or by seeking, changing
- // to full screen, minimizing the browser etc. The interval is measured by
- // media time.
-
- UMA_HISTOGRAM_CUSTOM_TIMES(
- "Media.MSE.PlaybackDuration", duration,
wolenetz 2016/09/30 23:23:23 Deprecate this in histograms.xml?
DaleCurtis 2016/09/30 23:34:24 Done.
- base::TimeDelta::FromSeconds(kMinDurationInSeconds),
- base::TimeDelta::FromSeconds(kMaxDurationInSeconds), kNumDurationSlots);
-
- // Number of late frames per one million frames.
-
- if (audio_frame_stats_.total) {
- UMA_HISTOGRAM_COUNTS(
- "Media.MSE.LateAudioFrames",
wolenetz 2016/09/30 23:23:23 ditto
DaleCurtis 2016/09/30 23:34:24 Done.
- kOneMillion * audio_frame_stats_.late / audio_frame_stats_.total);
- }
-
- if (video_frame_stats_.total) {
- UMA_HISTOGRAM_COUNTS(
- "Media.MSE.LateVideoFrames",
wolenetz 2016/09/30 23:23:23 ditto
DaleCurtis 2016/09/30 23:34:24 Done.
- kOneMillion * video_frame_stats_.late / video_frame_stats_.total);
- }
-
- // Number of starvations per one million frames.
-
- uint32_t total_frames = audio_frame_stats_.total ? audio_frame_stats_.total
- : video_frame_stats_.total;
- if (total_frames) {
- UMA_HISTOGRAM_COUNTS("Media.MSE.Starvations",
wolenetz 2016/09/30 23:23:23 ditto
DaleCurtis 2016/09/30 23:34:24 Done.
- kOneMillion * num_starvations_ / total_frames);
- }
-}
-
-} // namespace media

Powered by Google App Engine
This is Rietveld 408576698