OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/decoder_stream_traits.h" | 5 #include "media/filters/decoder_stream_traits.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 // static | 38 // static |
39 DecoderStreamTraits<DemuxerStream::AUDIO>::DecoderConfigType | 39 DecoderStreamTraits<DemuxerStream::AUDIO>::DecoderConfigType |
40 DecoderStreamTraits<DemuxerStream::AUDIO>::GetDecoderConfig( | 40 DecoderStreamTraits<DemuxerStream::AUDIO>::GetDecoderConfig( |
41 DemuxerStream* stream) { | 41 DemuxerStream* stream) { |
42 return stream->audio_decoder_config(); | 42 return stream->audio_decoder_config(); |
43 } | 43 } |
44 | 44 |
45 DecoderStreamTraits<DemuxerStream::AUDIO>::DecoderStreamTraits( | 45 DecoderStreamTraits<DemuxerStream::AUDIO>::DecoderStreamTraits( |
46 const scoped_refptr<MediaLog>& media_log) | 46 MediaLog* media_log) |
47 : media_log_(media_log) {} | 47 : media_log_(media_log) {} |
48 | 48 |
49 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics( | 49 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics( |
50 const StatisticsCB& statistics_cb, | 50 const StatisticsCB& statistics_cb, |
51 int bytes_decoded) { | 51 int bytes_decoded) { |
52 PipelineStatistics statistics; | 52 PipelineStatistics statistics; |
53 statistics.audio_bytes_decoded = bytes_decoded; | 53 statistics.audio_bytes_decoded = bytes_decoded; |
54 statistics_cb.Run(statistics); | 54 statistics_cb.Run(statistics); |
55 } | 55 } |
56 | 56 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 // static | 106 // static |
107 DecoderStreamTraits<DemuxerStream::VIDEO>::DecoderConfigType | 107 DecoderStreamTraits<DemuxerStream::VIDEO>::DecoderConfigType |
108 DecoderStreamTraits<DemuxerStream::VIDEO>::GetDecoderConfig( | 108 DecoderStreamTraits<DemuxerStream::VIDEO>::GetDecoderConfig( |
109 DemuxerStream* stream) { | 109 DemuxerStream* stream) { |
110 return stream->video_decoder_config(); | 110 return stream->video_decoder_config(); |
111 } | 111 } |
112 | 112 |
113 DecoderStreamTraits<DemuxerStream::VIDEO>::DecoderStreamTraits( | 113 DecoderStreamTraits<DemuxerStream::VIDEO>::DecoderStreamTraits( |
114 const scoped_refptr<MediaLog>& media_log) | 114 MediaLog* media_log) |
115 // Randomly selected number of samples to keep. | 115 // Randomly selected number of samples to keep. |
116 : keyframe_distance_average_(16) {} | 116 : keyframe_distance_average_(16) {} |
117 | 117 |
118 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics( | 118 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics( |
119 const StatisticsCB& statistics_cb, | 119 const StatisticsCB& statistics_cb, |
120 int bytes_decoded) { | 120 int bytes_decoded) { |
121 PipelineStatistics statistics; | 121 PipelineStatistics statistics; |
122 statistics.video_bytes_decoded = bytes_decoded; | 122 statistics.video_bytes_decoded = bytes_decoded; |
123 | 123 |
124 if (keyframe_distance_average_.count()) { | 124 if (keyframe_distance_average_.count()) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 | 171 |
172 base::TimeDelta frame_distance = | 172 base::TimeDelta frame_distance = |
173 current_frame_timestamp - last_keyframe_timestamp_; | 173 current_frame_timestamp - last_keyframe_timestamp_; |
174 UMA_HISTOGRAM_MEDIUM_TIMES("Media.Video.KeyFrameDistance", frame_distance); | 174 UMA_HISTOGRAM_MEDIUM_TIMES("Media.Video.KeyFrameDistance", frame_distance); |
175 last_keyframe_timestamp_ = current_frame_timestamp; | 175 last_keyframe_timestamp_ = current_frame_timestamp; |
176 keyframe_distance_average_.AddSample(frame_distance); | 176 keyframe_distance_average_.AddSample(frame_distance); |
177 } | 177 } |
178 | 178 |
179 } // namespace media | 179 } // namespace media |
OLD | NEW |