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

Unified Diff: media/audio/alsa/alsa_output.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/alsa/alsa_output.h
diff --git a/media/audio/alsa/alsa_output.h b/media/audio/alsa/alsa_output.h
index 7b2337a3378230fda9ac169bc119ed458aa5a1ff..ec4ca80208e0a5d9fbb026c4b0477ab1576aba2b 100644
--- a/media/audio/alsa/alsa_output.h
+++ b/media/audio/alsa/alsa_output.h
@@ -34,6 +34,7 @@
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/non_thread_safe.h"
+#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "media/audio/audio_io.h"
#include "media/base/audio_parameters.h"
@@ -84,6 +85,8 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream,
void SetVolume(double volume) override;
void GetVolume(double* volume) override;
+ void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
+
private:
friend class AlsaPcmOutputStreamTest;
FRIEND_TEST_ALL_PREFIXES(AlsaPcmOutputStreamTest,
@@ -129,7 +132,6 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream,
void ScheduleNextWrite(bool source_exhausted);
// Utility functions for talking with the ALSA API.
- static base::TimeDelta FramesToTimeDelta(int frames, double sample_rate);
std::string FindDeviceForChannels(uint32_t channels);
snd_pcm_sframes_t GetAvailableFrames();
snd_pcm_sframes_t GetCurrentDelay();
@@ -152,7 +154,9 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream,
// is passed into the output stream, but ownership is not transfered which
// requires a synchronization on access of the |source_callback_| to avoid
// using a deleted callback.
- int RunDataCallback(AudioBus* audio_bus, uint32_t total_bytes_delay);
+ int RunDataCallback(base::TimeDelta delay,
+ base::TimeTicks delay_timestamp,
+ AudioBus* audio_bus);
void RunErrorCallback(int code);
// Changes the AudioSourceCallback to proxy calls to. Pass in NULL to
@@ -208,6 +212,8 @@ class MEDIA_EXPORT AlsaPcmOutputStream : public AudioOutputStream,
std::unique_ptr<ChannelMixer> channel_mixer_;
std::unique_ptr<AudioBus> mixed_audio_bus_;
+ std::unique_ptr<base::TickClock> tick_clock_;
+
// Allows us to run tasks on the AlsaPcmOutputStream instance which are
// bound by its lifetime.
// NOTE: Weak pointers must be invalidated before all other member variables.

Powered by Google App Engine
This is Rietveld 408576698