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

Unified Diff: media/audio/audio_device_thread.h

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review commnets + more tests fixes + 'Packet' structure Created 4 years, 6 months 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_device_thread.h
diff --git a/media/audio/audio_device_thread.h b/media/audio/audio_device_thread.h
index 61e5e8724ddc24b289c01c364e3491b137779462..6507efd1c7eed6c38eca9fce6d2e9f3d41a1d019 100644
--- a/media/audio/audio_device_thread.h
+++ b/media/audio/audio_device_thread.h
@@ -12,6 +12,7 @@
#include "base/memory/shared_memory.h"
#include "base/sync_socket.h"
#include "base/synchronization/lock.h"
+#include "media/audio/audio_io.h"
#include "media/base/audio_parameters.h"
#include "media/base/media_export.h"
@@ -21,6 +22,7 @@ class MessageLoop;
namespace media {
class AudioBus;
+struct AudioTimestamp;
// Data transfer between browser and render process uses a combination
// of sync sockets and shared memory. To read from the socket and render
@@ -52,7 +54,9 @@ class MEDIA_EXPORT AudioDeviceThread {
virtual void MapSharedMemory() = 0;
// Called whenever we receive notifications about pending input data.
- virtual void Process(uint32_t pending_data) = 0;
+ // It also provides the current audio stream timestamp on the device.
+ virtual void Process(uint32_t pending_data,
+ const AudioTimestamp& timestamp) = 0;
protected:
// Protected so that derived classes can access directly.
@@ -75,6 +79,12 @@ class MEDIA_EXPORT AudioDeviceThread {
AudioDeviceThread();
~AudioDeviceThread();
+ // Represents a data packet to be received via the socket.
+ struct Packet {
+ uint32_t pending_data;
+ AudioTimestamp timestamp;
+ };
+
// Starts the audio thread. The thread must not already be running. If
// |sychronized_buffers| is set, the browser expects to be notified via the
// |socket| every time AudioDeviceThread::Process() completes.

Powered by Google App Engine
This is Rietveld 408576698