| OLD | NEW |
| 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/audio_decoder_config.h" | 5 #include "media/base/audio_decoder_config.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/base/limits.h" | 8 #include "media/base/limits.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 codec_ = codec; | 43 codec_ = codec; |
| 44 channel_layout_ = channel_layout; | 44 channel_layout_ = channel_layout; |
| 45 samples_per_second_ = samples_per_second; | 45 samples_per_second_ = samples_per_second; |
| 46 sample_format_ = sample_format; | 46 sample_format_ = sample_format; |
| 47 bytes_per_channel_ = SampleFormatToBytesPerChannel(sample_format); | 47 bytes_per_channel_ = SampleFormatToBytesPerChannel(sample_format); |
| 48 extra_data_ = extra_data; | 48 extra_data_ = extra_data; |
| 49 encryption_scheme_ = encryption_scheme; | 49 encryption_scheme_ = encryption_scheme; |
| 50 seek_preroll_ = seek_preroll; | 50 seek_preroll_ = seek_preroll; |
| 51 codec_delay_ = codec_delay; | 51 codec_delay_ = codec_delay; |
| 52 | 52 |
| 53 int channels = ChannelLayoutToChannelCount(channel_layout_); | 53 // If |channel_layout_| is CHANNEL_LAYOUT_DISCRETE, |channels_| and |
| 54 bytes_per_frame_ = channels * bytes_per_channel_; | 54 // |bytes_per_frame_| will be overwritten in set_channels_for_discrete() |
| 55 channels_ = ChannelLayoutToChannelCount(channel_layout_); |
| 56 bytes_per_frame_ = channels_ * bytes_per_channel_; |
| 55 } | 57 } |
| 56 | 58 |
| 57 AudioDecoderConfig::~AudioDecoderConfig() {} | 59 AudioDecoderConfig::~AudioDecoderConfig() {} |
| 58 | 60 |
| 59 bool AudioDecoderConfig::IsValidConfig() const { | 61 bool AudioDecoderConfig::IsValidConfig() const { |
| 60 return codec_ != kUnknownAudioCodec && | 62 return codec_ != kUnknownAudioCodec && |
| 61 channel_layout_ != CHANNEL_LAYOUT_UNSUPPORTED && | 63 channel_layout_ != CHANNEL_LAYOUT_UNSUPPORTED && |
| 62 bytes_per_channel_ > 0 && | 64 bytes_per_channel_ > 0 && |
| 63 bytes_per_channel_ <= limits::kMaxBytesPerSample && | 65 bytes_per_channel_ <= limits::kMaxBytesPerSample && |
| 64 samples_per_second_ > 0 && | 66 samples_per_second_ > 0 && |
| (...skipping 24 matching lines...) Expand all Loading... |
| 89 << " sample_format: " << sample_format() | 91 << " sample_format: " << sample_format() |
| 90 << " bytes_per_frame: " << bytes_per_frame() | 92 << " bytes_per_frame: " << bytes_per_frame() |
| 91 << " seek_preroll: " << seek_preroll().InMilliseconds() << "ms" | 93 << " seek_preroll: " << seek_preroll().InMilliseconds() << "ms" |
| 92 << " codec_delay: " << codec_delay() << " has extra data? " | 94 << " codec_delay: " << codec_delay() << " has extra data? " |
| 93 << (extra_data().empty() ? "false" : "true") << " encrypted? " | 95 << (extra_data().empty() ? "false" : "true") << " encrypted? " |
| 94 << (is_encrypted() ? "true" : "false"); | 96 << (is_encrypted() ? "true" : "false"); |
| 95 return s.str(); | 97 return s.str(); |
| 96 } | 98 } |
| 97 | 99 |
| 98 } // namespace media | 100 } // namespace media |
| OLD | NEW |