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 "media/base/limits.h" | 7 #include "media/base/limits.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 int AudioParameters::GetBytesPerSecond() const { | 61 int AudioParameters::GetBytesPerSecond() const { |
62 return sample_rate_ * GetBytesPerFrame(); | 62 return sample_rate_ * GetBytesPerFrame(); |
63 } | 63 } |
64 | 64 |
65 int AudioParameters::GetBytesPerFrame() const { | 65 int AudioParameters::GetBytesPerFrame() const { |
66 return channels_ * bits_per_sample_ / 8; | 66 return channels_ * bits_per_sample_ / 8; |
67 } | 67 } |
68 | 68 |
69 bool AudioParameters::Compare::operator()( | |
70 const AudioParameters& a, | |
71 const AudioParameters& b) const { | |
72 if (a.format_ < b.format_) | |
73 return true; | |
74 if (a.format_ > b.format_) | |
75 return false; | |
76 if (a.channels_ < b.channels_) | |
77 return true; | |
78 if (a.channels_ > b.channels_) | |
79 return false; | |
80 if (a.sample_rate_ < b.sample_rate_) | |
81 return true; | |
82 if (a.sample_rate_ > b.sample_rate_) | |
83 return false; | |
84 if (a.bits_per_sample_ < b.bits_per_sample_) | |
85 return true; | |
86 if (a.bits_per_sample_ > b.bits_per_sample_) | |
87 return false; | |
88 return a.frames_per_buffer_ < b.frames_per_buffer_; | |
89 } | |
90 | |
91 } // namespace media | 69 } // namespace media |
OLD | NEW |