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

Unified Diff: media/audio/audio_io.h

Issue 2101303004: Pass delay and timestamp to AudioSourceCallback::OnMoreData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix Mac CQ errors. Created 4 years, 3 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..e09b36eac2f88b61f8c530bcb4f296560cebd80f 100644
--- a/media/audio/audio_io.h
+++ b/media/audio/audio_io.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include "base/time/time.h"
#include "media/base/audio_bus.h"
// Low-level audio output support. To make sound there are 3 objects involved:
@@ -59,13 +60,19 @@ class MEDIA_EXPORT AudioOutputStream {
public:
virtual ~AudioSourceCallback() {}
- // Provide more data by fully filling |dest|. The source will return
- // 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.
- virtual int OnMoreData(AudioBus* dest,
- uint32_t total_bytes_delay,
- uint32_t frames_skipped) = 0;
+ // Provide more data by fully filling |dest|. The source will return the
+ // number of frames it filled. |delay| is the duration of audio written to
+ // |dest| in prior calls to OnMoreData() that has not yet been played out,
+ // and |delay_timestamp| is the time when |delay| was measured. The time
+ // when the first sample added to |dest| is expected to be played out can be
+ // calculated by adding |delay| to |delay_timestamp|. The accuracy of
+ // |delay| and |delay_timestamp| may vary depending on the platform and
+ // implementation. |prior_frames_skipped| is the number of frames skipped by
+ // the consumer.
+ virtual int OnMoreData(base::TimeDelta delay,
+ base::TimeTicks delay_timestamp,
+ int prior_frames_skipped,
+ AudioBus* dest) = 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
@@ -114,14 +121,14 @@ class MEDIA_EXPORT AudioInputStream {
virtual void OnData(AudioInputStream* stream,
const AudioBus* source,
uint32_t hardware_delay_bytes,
- double volume){};
+ double volume) {}
// TODO(henrika): don't use; to be removed.
virtual void OnData(AudioInputStream* stream,
const uint8_t* src,
uint32_t size,
uint32_t hardware_delay_bytes,
- double volume){};
+ double volume) {}
// There was an error while recording audio. The audio sink cannot be
// destroyed yet. No direct action needed by the AudioInputStream, but it

Powered by Google App Engine
This is Rietveld 408576698