From 52f8c8b7c4f0b6fba3bce9c495073100546f8d9a Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 16 Sep 2013 03:26:04 -0400 Subject: [PATCH] Bug 904617: Part 2 - Expose Audio Stream Latency r=padenot,jesup --- content/media/AudioStream.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/content/media/AudioStream.cpp b/content/media/AudioStream.cpp index 3a3c6e73549..67a16d8a97f 100644 --- a/content/media/AudioStream.cpp +++ b/content/media/AudioStream.cpp @@ -322,6 +322,7 @@ class BufferedAudioStream : public AudioStream int64_t GetPosition(); int64_t GetPositionInFrames(); int64_t GetPositionInFramesInternal(); + int64_t GetLatencyInFrames(); bool IsPaused(); // This method acquires the monitor and forward the call to the base // class, to prevent a race on |mTimeStretcher|, in @@ -775,6 +776,17 @@ BufferedAudioStream::GetPositionInFramesUnlocked() return std::min(adjustedPosition, INT64_MAX); } +int64_t +BufferedAudioStream::GetLatencyInFrames() +{ + uint32_t latency; + if(cubeb_stream_get_latency(mCubebStream, &latency)) { + NS_WARNING("Could not get cubeb latency."); + return 0; + } + return static_cast(latency); +} + bool BufferedAudioStream::IsPaused() {