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

Unified Diff: media/audio/audio_io.h

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implementation of 'AudioContext.getOutputTimestamp' method 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_io.h
diff --git a/media/audio/audio_io.h b/media/audio/audio_io.h
index 66ff3f2dc98cf7af2324fa1cb58944e29c003342..bac385e0f25935d35c0defd64123ec67ba26b5e5 100644
--- a/media/audio/audio_io.h
+++ b/media/audio/audio_io.h
@@ -49,6 +49,16 @@
namespace media {
+struct MEDIA_EXPORT AudioTimestamp {
+ int64_t frames;
+ int64_t ticks; // Obtained from base::TimeTicks::ToInternalValue().
+};
+
+// Used in unittests.
+inline bool operator==(const AudioTimestamp& one, const AudioTimestamp& other) {
+ return one.ticks == other.ticks && one.frames == other.frames;
+}
+
class MEDIA_EXPORT AudioOutputStream {
public:
// Audio sources must implement AudioSourceCallback. This interface will be
@@ -63,9 +73,12 @@ class MEDIA_EXPORT AudioOutputStream {
// the number of frames it filled. |total_bytes_delay| contains current
// number of bytes of delay buffered by the AudioOutputStream.
// |frames_skipped| contains the number of frames skipped by the consumer.
+ // |timestamp| if provided, contains timestamp of the currently audible
+ // signal.
virtual int OnMoreData(AudioBus* dest,
uint32_t total_bytes_delay,
- uint32_t frames_skipped) = 0;
+ uint32_t frames_skipped,
+ const AudioTimestamp& output_timestamp = {0, 0}) = 0;
// There was an error while playing a buffer. Audio source cannot be
// destroyed yet. No direct action needed by the AudioStream, but it is

Powered by Google App Engine
This is Rietveld 408576698