Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: media/audio/audio_parameters.cc

Issue 5158003: Implement AudioOutputProxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_parameters.cc
diff --git a/media/audio/audio_parameters.cc b/media/audio/audio_parameters.cc
index b0a691b6da616c9c5270961f993c3b1c216df72c..6d178faabca2252b2172615ecaa99a0d006d6c2f 100644
--- a/media/audio/audio_parameters.cc
+++ b/media/audio/audio_parameters.cc
@@ -37,3 +37,27 @@ bool AudioParameters::IsValid() const {
int AudioParameters::GetPacketSize() const {
return samples_per_packet * channels * bits_per_sample / 8;
}
+
+// CompareAudioParams is needed for map to use AudioParameters as a
+// map key.
+bool AudioParameters::CompareAudioParams::operator()(
scherkus (not reviewing) 2010/11/24 02:01:59 we should get a unit test slapped on this + GetPac
Sergey Ulanov 2010/11/24 03:49:54 Done.
+ const AudioParameters& a,
+ const AudioParameters& b) const {
+ if (a.format < b.format)
+ return true;
+ if (a.format > b.format)
+ return false;
+ if (a.channels < b.channels)
+ return true;
+ if (a.channels > b.channels)
+ return false;
+ if (a.sample_rate < b.sample_rate)
+ return true;
+ if (a.sample_rate > b.sample_rate)
+ return false;
+ if (a.bits_per_sample < b.bits_per_sample)
+ return true;
+ if (a.bits_per_sample > b.bits_per_sample)
+ return false;
+ return a.samples_per_packet < b.samples_per_packet;
+}

Powered by Google App Engine
This is Rietveld 408576698