Chromium Code Reviews| 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/audio/audio_parameters.h" | 5 #include "media/audio/audio_parameters.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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 int bits_per_sample, int frames_per_buffer) { | 61 int bits_per_sample, int frames_per_buffer) { |
| 62 format_ = format; | 62 format_ = format; |
| 63 channel_layout_ = channel_layout; | 63 channel_layout_ = channel_layout; |
| 64 channels_ = channels; | 64 channels_ = channels; |
| 65 sample_rate_ = sample_rate; | 65 sample_rate_ = sample_rate; |
| 66 bits_per_sample_ = bits_per_sample; | 66 bits_per_sample_ = bits_per_sample; |
| 67 frames_per_buffer_ = frames_per_buffer; | 67 frames_per_buffer_ = frames_per_buffer; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool AudioParameters::IsValid() const { | 70 bool AudioParameters::IsValid() const { |
| 71 return (format_ >= AUDIO_PCM_LINEAR) && | 71 return (channels_ > 0) && (channels_ <= media::limits::kMaxChannels) && |
| 72 (format_ < AUDIO_LAST_FORMAT) && | |
|
dcheng
2015/06/29 21:46:55
Removing these two lines causes two unit tests to
xhwang
2015/06/29 23:53:15
I agree :)
Tom Sepez
2015/06/30 15:37:07
Now that the enums are being checked by IPC itself
dcheng
2015/06/30 18:11:59
I just wanted to make sure that media code wasn't
| |
| 73 (channels_ > 0) && | |
| 74 (channels_ <= media::limits::kMaxChannels) && | |
| 75 (channel_layout_ > CHANNEL_LAYOUT_UNSUPPORTED) && | 72 (channel_layout_ > CHANNEL_LAYOUT_UNSUPPORTED) && |
| 76 (channel_layout_ <= CHANNEL_LAYOUT_MAX) && | |
| 77 (sample_rate_ >= media::limits::kMinSampleRate) && | 73 (sample_rate_ >= media::limits::kMinSampleRate) && |
| 78 (sample_rate_ <= media::limits::kMaxSampleRate) && | 74 (sample_rate_ <= media::limits::kMaxSampleRate) && |
| 79 (bits_per_sample_ > 0) && | 75 (bits_per_sample_ > 0) && |
| 80 (bits_per_sample_ <= media::limits::kMaxBitsPerSample) && | 76 (bits_per_sample_ <= media::limits::kMaxBitsPerSample) && |
| 81 (frames_per_buffer_ > 0) && | 77 (frames_per_buffer_ > 0) && |
| 82 (frames_per_buffer_ <= media::limits::kMaxSamplesPerPacket) && | 78 (frames_per_buffer_ <= media::limits::kMaxSamplesPerPacket) && |
| 83 (channel_layout_ == CHANNEL_LAYOUT_DISCRETE || | 79 (channel_layout_ == CHANNEL_LAYOUT_DISCRETE || |
| 84 channels_ == ChannelLayoutToChannelCount(channel_layout_)); | 80 channels_ == ChannelLayoutToChannelCount(channel_layout_)); |
| 85 } | 81 } |
| 86 | 82 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 117 return format_ == other.format() && | 113 return format_ == other.format() && |
| 118 sample_rate_ == other.sample_rate() && | 114 sample_rate_ == other.sample_rate() && |
| 119 channel_layout_ == other.channel_layout() && | 115 channel_layout_ == other.channel_layout() && |
| 120 channels_ == other.channels() && | 116 channels_ == other.channels() && |
| 121 bits_per_sample_ == other.bits_per_sample() && | 117 bits_per_sample_ == other.bits_per_sample() && |
| 122 frames_per_buffer_ == other.frames_per_buffer() && | 118 frames_per_buffer_ == other.frames_per_buffer() && |
| 123 effects_ == other.effects(); | 119 effects_ == other.effects(); |
| 124 } | 120 } |
| 125 | 121 |
| 126 } // namespace media | 122 } // namespace media |
| OLD | NEW |