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

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

Issue 743483002: Emit Media Source codec names as media_log events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the switces for android g++ Created 6 years, 1 month 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 | « media/base/video_decoder_config.h ('k') | media/blink/webmediaplayer_impl.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/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 {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 (visible_rect() == config.visible_rect()) && 106 (visible_rect() == config.visible_rect()) &&
107 (natural_size() == config.natural_size()) && 107 (natural_size() == config.natural_size()) &&
108 (extra_data_size() == config.extra_data_size()) && 108 (extra_data_size() == config.extra_data_size()) &&
109 (!extra_data() || !memcmp(extra_data(), config.extra_data(), 109 (!extra_data() || !memcmp(extra_data(), config.extra_data(),
110 extra_data_size())) && 110 extra_data_size())) &&
111 (is_encrypted() == config.is_encrypted())); 111 (is_encrypted() == config.is_encrypted()));
112 } 112 }
113 113
114 std::string VideoDecoderConfig::AsHumanReadableString() const { 114 std::string VideoDecoderConfig::AsHumanReadableString() const {
115 std::ostringstream s; 115 std::ostringstream s;
116 s << "codec: " << codec() 116 s << "codec: " << GetHumanReadableCodecName()
117 << " format: " << format() 117 << " format: " << format()
118 << " profile: " << profile() 118 << " profile: " << profile()
119 << " coded size: [" << coded_size().width() 119 << " coded size: [" << coded_size().width()
120 << "," << coded_size().height() << "]" 120 << "," << coded_size().height() << "]"
121 << " visible rect: [" << visible_rect().x() 121 << " visible rect: [" << visible_rect().x()
122 << "," << visible_rect().y() 122 << "," << visible_rect().y()
123 << "," << visible_rect().width() 123 << "," << visible_rect().width()
124 << "," << visible_rect().height() << "]" 124 << "," << visible_rect().height() << "]"
125 << " natural size: [" << natural_size().width() 125 << " natural size: [" << natural_size().width()
126 << "," << natural_size().height() << "]" 126 << "," << natural_size().height() << "]"
127 << " has extra data? " << (extra_data() ? "true" : "false") 127 << " has extra data? " << (extra_data() ? "true" : "false")
128 << " encrypted? " << (is_encrypted() ? "true" : "false"); 128 << " encrypted? " << (is_encrypted() ? "true" : "false");
129 return s.str(); 129 return s.str();
130 } 130 }
131 131
132 // The names come from src/third_party/ffmpeg/libavcodec/codec_desc.c
133 std::string VideoDecoderConfig::GetHumanReadableCodecName() const {
134 switch (codec()) {
135 case kUnknownVideoCodec:
136 return "unknown";
137 case kCodecH264:
138 return "h264";
139 case kCodecVC1:
140 return "vc1";
141 case kCodecMPEG2:
142 return "mpeg2video";
143 case kCodecMPEG4:
144 return "mpeg4";
145 case kCodecTheora:
146 return "theora";
147 case kCodecVP8:
148 return "vp8";
149 case kCodecVP9:
150 return "vp9";
151 }
152 NOTREACHED();
153 return "";
154 }
155
132 VideoCodec VideoDecoderConfig::codec() const { 156 VideoCodec VideoDecoderConfig::codec() const {
133 return codec_; 157 return codec_;
134 } 158 }
135 159
136 VideoCodecProfile VideoDecoderConfig::profile() const { 160 VideoCodecProfile VideoDecoderConfig::profile() const {
137 return profile_; 161 return profile_;
138 } 162 }
139 163
140 VideoFrame::Format VideoDecoderConfig::format() const { 164 VideoFrame::Format VideoDecoderConfig::format() const {
141 return format_; 165 return format_;
(...skipping 19 matching lines...) Expand all
161 185
162 size_t VideoDecoderConfig::extra_data_size() const { 186 size_t VideoDecoderConfig::extra_data_size() const {
163 return extra_data_.size(); 187 return extra_data_.size();
164 } 188 }
165 189
166 bool VideoDecoderConfig::is_encrypted() const { 190 bool VideoDecoderConfig::is_encrypted() const {
167 return is_encrypted_; 191 return is_encrypted_;
168 } 192 }
169 193
170 } // namespace media 194 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_decoder_config.h ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698