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

Side by Side Diff: media/base/video_decoder_config.cc

Issue 231283005: Add live mode detection in WebM MediaSource parser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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/base/video_decoder_config.h" 5 #include "media/base/video_decoder_config.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 9
10 namespace media { 10 namespace media {
11 11
12 VideoDecoderConfig::VideoDecoderConfig() 12 VideoDecoderConfig::VideoDecoderConfig()
13 : codec_(kUnknownVideoCodec), 13 : codec_(kUnknownVideoCodec),
14 profile_(VIDEO_CODEC_PROFILE_UNKNOWN), 14 profile_(VIDEO_CODEC_PROFILE_UNKNOWN),
15 format_(VideoFrame::UNKNOWN), 15 format_(VideoFrame::UNKNOWN),
16 is_encrypted_(false) { 16 is_encrypted_(false) {
17 } 17 }
18 18
19 VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec, 19 VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec,
20 VideoCodecProfile profile, 20 VideoCodecProfile profile,
21 VideoFrame::Format format, 21 VideoFrame::Format format,
22 const gfx::Size& coded_size, 22 const gfx::Size& coded_size,
23 const gfx::Rect& visible_rect, 23 const gfx::Rect& visible_rect,
24 const gfx::Size& natural_size, 24 const gfx::Size& natural_size,
25 const uint8* extra_data, 25 const uint8* extra_data,
26 size_t extra_data_size, 26 size_t extra_data_size,
27 bool is_encrypted) { 27 bool is_encrypted,
28 bool low_delay) {
28 Initialize(codec, profile, format, coded_size, visible_rect, natural_size, 29 Initialize(codec, profile, format, coded_size, visible_rect, natural_size,
29 extra_data, extra_data_size, is_encrypted, true); 30 extra_data, extra_data_size, is_encrypted, low_delay, true);
30 } 31 }
31 32
32 VideoDecoderConfig::~VideoDecoderConfig() {} 33 VideoDecoderConfig::~VideoDecoderConfig() {}
33 34
34 // Some videos just want to watch the world burn, with a height of 0; cap the 35 // Some videos just want to watch the world burn, with a height of 0; cap the
35 // "infinite" aspect ratio resulting. 36 // "infinite" aspect ratio resulting.
36 static const int kInfiniteRatio = 99999; 37 static const int kInfiniteRatio = 99999;
37 38
38 // Common aspect ratios (multiplied by 100 and truncated) used for histogramming 39 // Common aspect ratios (multiplied by 100 and truncated) used for histogramming
39 // video sizes. These were taken on 20111103 from 40 // video sizes. These were taken on 20111103 from
(...skipping 15 matching lines...) Expand all
55 56
56 void VideoDecoderConfig::Initialize(VideoCodec codec, 57 void VideoDecoderConfig::Initialize(VideoCodec codec,
57 VideoCodecProfile profile, 58 VideoCodecProfile profile,
58 VideoFrame::Format format, 59 VideoFrame::Format format,
59 const gfx::Size& coded_size, 60 const gfx::Size& coded_size,
60 const gfx::Rect& visible_rect, 61 const gfx::Rect& visible_rect,
61 const gfx::Size& natural_size, 62 const gfx::Size& natural_size,
62 const uint8* extra_data, 63 const uint8* extra_data,
63 size_t extra_data_size, 64 size_t extra_data_size,
64 bool is_encrypted, 65 bool is_encrypted,
66 bool low_delay,
65 bool record_stats) { 67 bool record_stats) {
66 CHECK((extra_data_size != 0) == (extra_data != NULL)); 68 CHECK((extra_data_size != 0) == (extra_data != NULL));
67 69
68 if (record_stats) { 70 if (record_stats) {
69 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodec", codec, kVideoCodecMax + 1); 71 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodec", codec, kVideoCodecMax + 1);
70 // Drop UNKNOWN because U_H_E() uses one bucket for all values less than 1. 72 // Drop UNKNOWN because U_H_E() uses one bucket for all values less than 1.
71 if (profile >= 0) { 73 if (profile >= 0) {
72 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodecProfile", profile, 74 UMA_HISTOGRAM_ENUMERATION("Media.VideoCodecProfile", profile,
73 VIDEO_CODEC_PROFILE_MAX + 1); 75 VIDEO_CODEC_PROFILE_MAX + 1);
74 } 76 }
75 UMA_HISTOGRAM_COUNTS_10000("Media.VideoCodedWidth", coded_size.width()); 77 UMA_HISTOGRAM_COUNTS_10000("Media.VideoCodedWidth", coded_size.width());
76 UmaHistogramAspectRatio("Media.VideoCodedAspectRatio", coded_size); 78 UmaHistogramAspectRatio("Media.VideoCodedAspectRatio", coded_size);
77 UMA_HISTOGRAM_COUNTS_10000("Media.VideoVisibleWidth", visible_rect.width()); 79 UMA_HISTOGRAM_COUNTS_10000("Media.VideoVisibleWidth", visible_rect.width());
78 UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio", visible_rect); 80 UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio", visible_rect);
79 UMA_HISTOGRAM_ENUMERATION( 81 UMA_HISTOGRAM_ENUMERATION(
80 "Media.VideoPixelFormat", format, VideoFrame::FORMAT_MAX + 1); 82 "Media.VideoPixelFormat", format, VideoFrame::FORMAT_MAX + 1);
81 } 83 }
82 84
83 codec_ = codec; 85 codec_ = codec;
84 profile_ = profile; 86 profile_ = profile;
85 format_ = format; 87 format_ = format;
86 coded_size_ = coded_size; 88 coded_size_ = coded_size;
87 visible_rect_ = visible_rect; 89 visible_rect_ = visible_rect;
88 natural_size_ = natural_size; 90 natural_size_ = natural_size;
89 extra_data_.assign(extra_data, extra_data + extra_data_size); 91 extra_data_.assign(extra_data, extra_data + extra_data_size);
90 is_encrypted_ = is_encrypted; 92 is_encrypted_ = is_encrypted;
93 low_delay_ = low_delay;
91 } 94 }
92 95
93 bool VideoDecoderConfig::IsValidConfig() const { 96 bool VideoDecoderConfig::IsValidConfig() const {
94 return codec_ != kUnknownVideoCodec && 97 return codec_ != kUnknownVideoCodec &&
95 natural_size_.width() > 0 && 98 natural_size_.width() > 0 &&
96 natural_size_.height() > 0 && 99 natural_size_.height() > 0 &&
97 VideoFrame::IsValidConfig(format_, coded_size_, visible_rect_, 100 VideoFrame::IsValidConfig(format_, coded_size_, visible_rect_,
98 natural_size_); 101 natural_size_);
99 } 102 }
100 103
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 164
162 size_t VideoDecoderConfig::extra_data_size() const { 165 size_t VideoDecoderConfig::extra_data_size() const {
163 return extra_data_.size(); 166 return extra_data_.size();
164 } 167 }
165 168
166 bool VideoDecoderConfig::is_encrypted() const { 169 bool VideoDecoderConfig::is_encrypted() const {
167 return is_encrypted_; 170 return is_encrypted_;
168 } 171 }
169 172
170 } // namespace media 173 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698