Index: media/audio/audio_parameters.h |
diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h |
index be904f49068e1f15fb95328c37a96b403dfc901b..b9fb99840c625971680abb8c4fe40ee8e1d541f3 100644 |
--- a/media/audio/audio_parameters.h |
+++ b/media/audio/audio_parameters.h |
@@ -26,12 +26,6 @@ struct MEDIA_EXPORT AudioInputBuffer { |
class MEDIA_EXPORT AudioParameters { |
public: |
- // Compare is useful when AudioParameters is used as a key in std::map. |
- class MEDIA_EXPORT Compare { |
- public: |
- bool operator()(const AudioParameters& a, const AudioParameters& b) const; |
- }; |
- |
enum Format { |
AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. |
AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. |
@@ -85,6 +79,20 @@ class MEDIA_EXPORT AudioParameters { |
// |channel_layout|. |
}; |
+// Comparison is useful when AudioParameters is used with std structures. |
+inline bool operator<(const AudioParameters& a, |
+ const AudioParameters& b) { |
+ if (a.format() != b.format()) |
+ return a.format() < b.format(); |
+ if (a.channels() != b.channels()) |
+ return a.channels() < b.channels(); |
+ if (a.sample_rate() != b.sample_rate()) |
+ return a.sample_rate() < b.sample_rate(); |
+ if (a.bits_per_sample() != b.bits_per_sample()) |
+ return a.bits_per_sample() < b.bits_per_sample(); |
+ return a.frames_per_buffer() < b.frames_per_buffer(); |
+} |
+ |
} // namespace media |
#endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |