summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_buffers_state.h
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 01:21:27 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 01:21:27 +0000
commit5c86ecf8936269cdc5f00f57b7531cdac7b3e706 (patch)
tree79392d0c2e959af863e2b6d4626a79d039b178ab /media/audio/audio_buffers_state.h
parente10eacda58687b9363919a9203181322b649946c (diff)
downloadchromium_src-5c86ecf8936269cdc5f00f57b7531cdac7b3e706.zip
chromium_src-5c86ecf8936269cdc5f00f57b7531cdac7b3e706.tar.gz
chromium_src-5c86ecf8936269cdc5f00f57b7531cdac7b3e706.tar.bz2
Add AudioBuffersState struct. Use it for audio synchronization.
The new AudioBuffersState contains current state of the audio buffers. This object is passed all the way from the device to the audio renderer. Audio renderer uses this information to synchronize audio. BUG=52196,49110 TEST=see repro steps for 51637 and 52196. Review URL: http://codereview.chromium.org/3444017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_buffers_state.h')
-rw-r--r--media/audio/audio_buffers_state.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/media/audio/audio_buffers_state.h b/media/audio/audio_buffers_state.h
new file mode 100644
index 0000000..e3a2faf
--- /dev/null
+++ b/media/audio/audio_buffers_state.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_AUDIO_BUFFERS_STATE_H_
+#define MEDIA_AUDIO_AUDIO_BUFFERS_STATE_H_
+
+#include "base/time.h"
+
+// AudioBuffersState struct stores current state of audio buffers along with
+// the timestamp of the moment this state corresponds to. It is used for audio
+// synchronization.
+struct AudioBuffersState {
+ AudioBuffersState();
+ AudioBuffersState(int pending_bytes, int hardware_delay_bytes);
+
+ int total_bytes();
+
+ // Number of bytes we currently have in our software buffer.
+ int pending_bytes;
+
+ // Number of bytes that have been written to the device, but haven't
+ // been played yet.
+ int hardware_delay_bytes;
+
+ // Timestamp of the moment when the buffers state was captured. It is used
+ // to account for the time it takes to deliver AudioBuffersState from
+ // the browser process to the renderer.
+ base::Time timestamp;
+};
+
+
+#endif // MEDIA_AUDIO_AUDIO_BUFFERS_STATE_H_