diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/audio_buffers_state.cc | 12 | ||||
-rw-r--r-- | media/audio/audio_buffers_state.h | 18 |
2 files changed, 21 insertions, 9 deletions
diff --git a/media/audio/audio_buffers_state.cc b/media/audio/audio_buffers_state.cc index 7e829fe..f31cf1d 100644 --- a/media/audio/audio_buffers_state.cc +++ b/media/audio/audio_buffers_state.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// 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. @@ -6,11 +6,17 @@ AudioBuffersState::AudioBuffersState() : pending_bytes(0), - hardware_delay_bytes(0) { + hardware_delay_bytes(0), + timestamp(base::Time::Now()) { } AudioBuffersState::AudioBuffersState(int pending_bytes, int hardware_delay_bytes) : pending_bytes(pending_bytes), - hardware_delay_bytes(hardware_delay_bytes) { + hardware_delay_bytes(hardware_delay_bytes), + timestamp(base::Time::Now()) { +} + +int AudioBuffersState::total_bytes() { + return pending_bytes + hardware_delay_bytes; } diff --git a/media/audio/audio_buffers_state.h b/media/audio/audio_buffers_state.h index a7299e1..796c081 100644 --- a/media/audio/audio_buffers_state.h +++ b/media/audio/audio_buffers_state.h @@ -1,21 +1,21 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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" #include "media/base/media_export.h" -// AudioBuffersState struct stores current state of audio buffers. -// It is used for audio synchronization. +// 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 MEDIA_EXPORT AudioBuffersState { AudioBuffersState(); AudioBuffersState(int pending_bytes, int hardware_delay_bytes); - int total_bytes() { - return pending_bytes + hardware_delay_bytes; - } + int total_bytes(); // Number of bytes we currently have in our software buffer. int pending_bytes; @@ -23,6 +23,12 @@ struct MEDIA_EXPORT AudioBuffersState { // 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_ |