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

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: Added implementation for ALSA. Created 4 years, 5 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..e9f8168b67f17a1d6012354a4a165563e51545c3 100644
--- a/media/audio/audio_io.h
+++ b/media/audio/audio_io.h
@@ -49,6 +49,17 @@
namespace media {
+struct MEDIA_EXPORT AudioTimestamp {
+ AudioTimestamp() = default;
+ int64_t frames;
miu 2016/07/19 01:22:36 Why do we need this? Client code could track this
+ int64_t ticks; // Obtained from base::TimeTicks::ToInternalValue().
miu 2016/07/19 01:22:36 Don't use ToInternalValue(). As the header comment
+};
+
+// 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 +74,13 @@ 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.
- virtual int OnMoreData(AudioBus* dest,
- uint32_t total_bytes_delay,
- uint32_t frames_skipped) = 0;
+ // |timestamp| if provided, contains timestamp of the currently audible
+ // signal.
+ virtual int OnMoreData(
+ AudioBus* dest,
+ uint32_t total_bytes_delay,
+ uint32_t frames_skipped,
miu 2016/07/19 01:22:36 This is in conflict with this change: https://code
jameswest 2016/07/20 04:19:18 We're in favor of changing the API to the followin
+ const AudioTimestamp& output_timestamp = AudioTimestamp()) = 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