summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorcrogers@google.com <crogers@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-23 01:52:48 +0000
committercrogers@google.com <crogers@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-23 01:52:48 +0000
commit161ee06e2799fc4c83c7ce615f6bea157ccec906 (patch)
tree18d9abb1b63e4ff40fbf99e73cc1a38a9b0a4d5d /media
parent7785b17f588fb9d8b583f3a38db0bc40f414cc3d (diff)
downloadchromium_src-161ee06e2799fc4c83c7ce615f6bea157ccec906.zip
chromium_src-161ee06e2799fc4c83c7ce615f6bea157ccec906.tar.gz
chromium_src-161ee06e2799fc4c83c7ce615f6bea157ccec906.tar.bz2
Add WebKit API to retrieve the audio hardware sample-rate
BUG=none TEST=none Review URL: http://codereview.chromium.org/6721015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79088 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/audio/audio_util.cc15
-rw-r--r--media/audio/audio_util.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/media/audio/audio_util.cc b/media/audio/audio_util.cc
index 277bb1a..18e2abb 100644
--- a/media/audio/audio_util.cc
+++ b/media/audio/audio_util.cc
@@ -11,6 +11,9 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "media/audio/audio_util.h"
+#if defined(OS_MACOSX)
+#include "media/audio/mac/audio_low_latency_output_mac.h"
+#endif
namespace media {
@@ -219,4 +222,16 @@ void InterleaveFloatToInt16(const std::vector<float*>& source,
}
}
+double GetAudioHardwareSampleRate()
+{
+#if defined(OS_MACOSX)
+ // Hardware sample-rate on the Mac can be configured, so we must query.
+ return AUAudioOutputStream::HardwareSampleRate();
+#else
+ // Hardware for Windows and Linux is nearly always 48KHz.
+ // TODO(crogers) : return correct value in rare non-48KHz cases.
+ return 48000.0;
+#endif
+}
+
} // namespace media
diff --git a/media/audio/audio_util.h b/media/audio/audio_util.h
index 274c82c..15a0935 100644
--- a/media/audio/audio_util.h
+++ b/media/audio/audio_util.h
@@ -91,6 +91,9 @@ void SwizzleCoreAudioLayout5_1(Format* b, uint32 filled) {
}
}
+// Returns the default audio hardware sample-rate.
+double GetAudioHardwareSampleRate();
+
} // namespace media
#endif // MEDIA_AUDIO_AUDIO_UTIL_H_