From 078c07bd2f86818d95171bcc96c10d4aa5165242 Mon Sep 17 00:00:00 2001
From: "dalecurtis@chromium.org"
 <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 23 Oct 2013 21:33:46 +0000
Subject: Switch audio synchronization from sleep() based to select() based.

Uses select() to efficiently wait for data from the renderer with a
timeout instead of using sleep() or always assuming the renderer
is ready.

Fixes glitching and / or CPU hogging when the renderer isn't ready.

BUG=179058, 180841, 260772, 269672,
TEST=Swap from 44kHz to 16kHz html5 playback, ensure glitch free.

Review URL: https://codereview.chromium.org/22886005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230515 0039d316-1c4b-4281-b951-d872f2087c98
---
 media/audio/audio_parameters.h | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'media/audio/audio_parameters.h')

diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h
index bc629a7..9b86d31 100644
--- a/media/audio/audio_parameters.h
+++ b/media/audio/audio_parameters.h
@@ -6,6 +6,7 @@
 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_
 
 #include "base/basictypes.h"
+#include "base/time/time.h"
 #include "media/base/channel_layout.h"
 #include "media/base/media_export.h"
 
@@ -69,6 +70,10 @@ class MEDIA_EXPORT AudioParameters {
   // Returns the number of bytes representing a frame of audio.
   int GetBytesPerFrame() const;
 
+  // Returns the duration of this buffer as calculated from frames_per_buffer()
+  // and sample_rate().
+  base::TimeDelta GetBufferDuration() const;
+
   Format format() const { return format_; }
   ChannelLayout channel_layout() const { return channel_layout_; }
   int sample_rate() const { return sample_rate_; }
-- 
cgit v1.1