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

Side by Side Diff: media/filters/ffmpeg_demuxer.cc

Issue 2846693002: Add UMA metrics for VideoCodec.MP4 and VideoCodec.WebM (Closed)
Patch Set: Address comment #1 Created 3 years, 7 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
« no previous file with comments | « no previous file | media/filters/stream_parser_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "media/filters/ffmpeg_demuxer.h" 5 #include "media/filters/ffmpeg_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (ToAudioSampleRate(audio_config.samples_per_second(), &asr)) { 153 if (ToAudioSampleRate(audio_config.samples_per_second(), &asr)) {
154 UMA_HISTOGRAM_ENUMERATION("Media.AudioSamplesPerSecond", asr, 154 UMA_HISTOGRAM_ENUMERATION("Media.AudioSamplesPerSecond", asr,
155 kAudioSampleRateMax + 1); 155 kAudioSampleRateMax + 1);
156 } else { 156 } else {
157 UMA_HISTOGRAM_COUNTS("Media.AudioSamplesPerSecondUnexpected", 157 UMA_HISTOGRAM_COUNTS("Media.AudioSamplesPerSecondUnexpected",
158 audio_config.samples_per_second()); 158 audio_config.samples_per_second());
159 } 159 }
160 } 160 }
161 161
162 // Record video decoder config UMA stats corresponding to a src= playback. 162 // Record video decoder config UMA stats corresponding to a src= playback.
163 static void RecordVideoCodecStats(const VideoDecoderConfig& video_config, 163 // |format_names| is a comma separated list of short names for the media file
164 // format, e.g. "matroska,webm", "mov,mp4,3gp,3g2,mj2".
165 static void RecordVideoCodecStats(const char* format_names,
166 const VideoDecoderConfig& video_config,
164 AVColorRange color_range, 167 AVColorRange color_range,
165 MediaLog* media_log) { 168 MediaLog* media_log) {
166 media_log->RecordRapporWithSecurityOrigin("Media.OriginUrl.SRC.VideoCodec." + 169 media_log->RecordRapporWithSecurityOrigin("Media.OriginUrl.SRC.VideoCodec." +
167 GetCodecName(video_config.codec())); 170 GetCodecName(video_config.codec()));
168 171
169 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodec", video_config.codec(), 172 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodec", video_config.codec(),
170 kVideoCodecMax + 1); 173 kVideoCodecMax + 1);
174 if (strstr(format_names, "mp4")) {
DaleCurtis 2017/04/27 19:05:28 ffmpeg_glue has copies of these names too. I think
kqyang 2017/04/27 21:07:59 How about make container[1] a member variable of f
DaleCurtis 2017/04/27 21:10:43 Good suggestion, sgtm.
175 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodec.MP4", video_config.codec(),
176 kVideoCodecMax + 1);
177 } else if (strstr(format_names, "webm")) {
178 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodec.WebM", video_config.codec(),
179 kVideoCodecMax + 1);
180 }
171 181
172 // Drop UNKNOWN because U_H_E() uses one bucket for all values less than 1. 182 // Drop UNKNOWN because U_H_E() uses one bucket for all values less than 1.
173 if (video_config.profile() >= 0) { 183 if (video_config.profile() >= 0) {
174 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodecProfile", video_config.profile(), 184 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodecProfile", video_config.profile(),
175 VIDEO_CODEC_PROFILE_MAX + 1); 185 VIDEO_CODEC_PROFILE_MAX + 1);
176 } 186 }
177 UMA_HISTOGRAM_COUNTS_10000("Media.VideoVisibleWidth", 187 UMA_HISTOGRAM_COUNTS_10000("Media.VideoVisibleWidth",
178 video_config.visible_rect().width()); 188 video_config.visible_rect().width());
179 UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio", 189 UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio",
180 video_config.visible_rect()); 190 video_config.visible_rect());
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 1388
1379 media_track = media_tracks->AddAudioTrack(audio_config, track_id, "main", 1389 media_track = media_tracks->AddAudioTrack(audio_config, track_id, "main",
1380 track_label, track_language); 1390 track_label, track_language);
1381 media_track->set_id(base::UintToString(track_id)); 1391 media_track->set_id(base::UintToString(track_id));
1382 DCHECK(track_id_to_demux_stream_map_.find(media_track->id()) == 1392 DCHECK(track_id_to_demux_stream_map_.find(media_track->id()) ==
1383 track_id_to_demux_stream_map_.end()); 1393 track_id_to_demux_stream_map_.end());
1384 track_id_to_demux_stream_map_[media_track->id()] = streams_[i].get(); 1394 track_id_to_demux_stream_map_[media_track->id()] = streams_[i].get();
1385 } else if (codec_type == AVMEDIA_TYPE_VIDEO) { 1395 } else if (codec_type == AVMEDIA_TYPE_VIDEO) {
1386 VideoDecoderConfig video_config = streams_[i]->video_decoder_config(); 1396 VideoDecoderConfig video_config = streams_[i]->video_decoder_config();
1387 1397
1388 RecordVideoCodecStats(video_config, stream->codecpar->color_range, 1398 RecordVideoCodecStats(format_context->iformat->name, video_config,
1389 media_log_); 1399 stream->codecpar->color_range, media_log_);
1390 1400
1391 media_track = media_tracks->AddVideoTrack(video_config, track_id, "main", 1401 media_track = media_tracks->AddVideoTrack(video_config, track_id, "main",
1392 track_label, track_language); 1402 track_label, track_language);
1393 media_track->set_id(base::UintToString(track_id)); 1403 media_track->set_id(base::UintToString(track_id));
1394 DCHECK(track_id_to_demux_stream_map_.find(media_track->id()) == 1404 DCHECK(track_id_to_demux_stream_map_.find(media_track->id()) ==
1395 track_id_to_demux_stream_map_.end()); 1405 track_id_to_demux_stream_map_.end());
1396 track_id_to_demux_stream_map_[media_track->id()] = streams_[i].get(); 1406 track_id_to_demux_stream_map_[media_track->id()] = streams_[i].get();
1397 } 1407 }
1398 1408
1399 max_duration = std::max(max_duration, streams_[i]->duration()); 1409 max_duration = std::max(max_duration, streams_[i]->duration());
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 1891
1882 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { 1892 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) {
1883 DCHECK(task_runner_->BelongsToCurrentThread()); 1893 DCHECK(task_runner_->BelongsToCurrentThread());
1884 for (const auto& stream : streams_) { 1894 for (const auto& stream : streams_) {
1885 if (stream) 1895 if (stream)
1886 stream->SetLiveness(liveness); 1896 stream->SetLiveness(liveness);
1887 } 1897 }
1888 } 1898 }
1889 1899
1890 } // namespace media 1900 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/stream_parser_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698