Chromium Code Reviews| Index: media/base/audio_decoder_config.cc |
| diff --git a/media/base/audio_decoder_config.cc b/media/base/audio_decoder_config.cc |
| index bd0e6a7e75f84ea5ee4bf76c33e6a01e95597a69..e6901e9df9015b4c1246e7edede004f7161bdd03 100644 |
| --- a/media/base/audio_decoder_config.cc |
| +++ b/media/base/audio_decoder_config.cc |
| @@ -17,7 +17,8 @@ AudioDecoderConfig::AudioDecoderConfig() |
| channel_layout_(CHANNEL_LAYOUT_UNSUPPORTED), |
| samples_per_second_(0), |
| extra_data_size_(0), |
| - is_encrypted_(false) { |
| + is_encrypted_(false), |
| + sample_format_(kUnknownSampleFormat) { |
| } |
| AudioDecoderConfig::AudioDecoderConfig(AudioCodec codec, |
| @@ -26,9 +27,10 @@ AudioDecoderConfig::AudioDecoderConfig(AudioCodec codec, |
| int samples_per_second, |
| const uint8* extra_data, |
| size_t extra_data_size, |
| + SampleFormat sample_format, |
| bool is_encrypted) { |
| Initialize(codec, bits_per_channel, channel_layout, samples_per_second, |
| - extra_data, extra_data_size, is_encrypted, true); |
| + extra_data, extra_data_size, sample_format, is_encrypted, true); |
| } |
| void AudioDecoderConfig::Initialize(AudioCodec codec, |
| @@ -37,6 +39,7 @@ void AudioDecoderConfig::Initialize(AudioCodec codec, |
| int samples_per_second, |
| const uint8* extra_data, |
| size_t extra_data_size, |
| + SampleFormat sample_format, |
| bool is_encrypted, |
| bool record_stats) { |
| CHECK((extra_data_size != 0) == (extra_data != NULL)); |
| @@ -57,6 +60,9 @@ void AudioDecoderConfig::Initialize(AudioCodec codec, |
| UMA_HISTOGRAM_COUNTS( |
| "Media.AudioSamplesPerSecondUnexpected", samples_per_second); |
| } |
| + |
| + // TODO(dalecurtis): Is it worth recording SampleFormat here? All aac and |
| + // vorbis are going to be kFormatFLTP. Float PCM and AMR will be kFormatFLT. |
|
scherkus (not reviewing)
2012/12/06 17:25:32
is there any way to get the pre-conversion-to-floa
scherkus (not reviewing)
2012/12/06 17:25:32
s/kFormat/kSampleFormat/g
DaleCurtis
2012/12/06 22:15:41
The data isn't converted to float, it's decoded in
DaleCurtis
2012/12/11 03:03:44
Also I don't intend to check this message in, I wa
scherkus (not reviewing)
2012/12/11 21:18:47
What about deprecating AudioBitsPerChannel in favo
DaleCurtis
2012/12/12 01:02:57
Done.
|
| } |
| codec_ = codec; |
| @@ -64,6 +70,7 @@ void AudioDecoderConfig::Initialize(AudioCodec codec, |
| channel_layout_ = channel_layout; |
| samples_per_second_ = samples_per_second; |
| extra_data_size_ = extra_data_size; |
| + sample_format_ = sample_format; |
| if (extra_data_size_ > 0) { |
| extra_data_.reset(new uint8[extra_data_size_]); |
| @@ -79,11 +86,12 @@ AudioDecoderConfig::~AudioDecoderConfig() {} |
| bool AudioDecoderConfig::IsValidConfig() const { |
| return codec_ != kUnknownAudioCodec && |
| - channel_layout_ != CHANNEL_LAYOUT_UNSUPPORTED && |
| - bits_per_channel_ > 0 && |
| - bits_per_channel_ <= limits::kMaxBitsPerSample && |
| - samples_per_second_ > 0 && |
| - samples_per_second_ <= limits::kMaxSampleRate; |
| + channel_layout_ != CHANNEL_LAYOUT_UNSUPPORTED && |
| + bits_per_channel_ > 0 && |
| + bits_per_channel_ <= limits::kMaxBitsPerSample && |
| + samples_per_second_ > 0 && |
| + samples_per_second_ <= limits::kMaxSampleRate && |
| + sample_format_ != kUnknownSampleFormat; |
| } |
| bool AudioDecoderConfig::Matches(const AudioDecoderConfig& config) const { |
| @@ -94,7 +102,8 @@ bool AudioDecoderConfig::Matches(const AudioDecoderConfig& config) const { |
| (extra_data_size() == config.extra_data_size()) && |
| (!extra_data() || !memcmp(extra_data(), config.extra_data(), |
| extra_data_size())) && |
| - (is_encrypted() == config.is_encrypted())); |
| + (is_encrypted() == config.is_encrypted()) && |
| + (sample_format() == config.sample_format())); |
| } |
| void AudioDecoderConfig::CopyFrom(const AudioDecoderConfig& audio_config) { |
| @@ -104,36 +113,9 @@ void AudioDecoderConfig::CopyFrom(const AudioDecoderConfig& audio_config) { |
| audio_config.samples_per_second(), |
| audio_config.extra_data(), |
| audio_config.extra_data_size(), |
| + audio_config.sample_format(), |
| audio_config.is_encrypted(), |
| false); |
| } |
| -AudioCodec AudioDecoderConfig::codec() const { |
| - return codec_; |
| -} |
| - |
| -int AudioDecoderConfig::bits_per_channel() const { |
| - return bits_per_channel_; |
| -} |
| - |
| -ChannelLayout AudioDecoderConfig::channel_layout() const { |
| - return channel_layout_; |
| -} |
| - |
| -int AudioDecoderConfig::samples_per_second() const { |
| - return samples_per_second_; |
| -} |
| - |
| -uint8* AudioDecoderConfig::extra_data() const { |
| - return extra_data_.get(); |
| -} |
| - |
| -size_t AudioDecoderConfig::extra_data_size() const { |
| - return extra_data_size_; |
| -} |
| - |
| -bool AudioDecoderConfig::is_encrypted() const { |
| - return is_encrypted_; |
| -} |
| - |
| } // namespace media |