mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 1181913 - fix data race in AudioSink::mWritten. r=kinetik
This commit is contained in:
parent
56a826cd0a
commit
ac161fa645
@ -199,7 +199,8 @@ AudioSink::AudioLoop()
|
||||
CheckedInt64 sampleTime = UsecsToFrames(AudioQueue().PeekFront()->mTime, mInfo.mRate);
|
||||
|
||||
// Calculate the number of frames that have been pushed onto the audio hardware.
|
||||
CheckedInt64 playedFrames = UsecsToFrames(mStartTime, mInfo.mRate) + mWritten;
|
||||
CheckedInt64 playedFrames = UsecsToFrames(mStartTime, mInfo.mRate) +
|
||||
static_cast<int64_t>(mWritten);
|
||||
|
||||
CheckedInt64 missingFrames = sampleTime - playedFrames;
|
||||
if (!missingFrames.isValid() || !sampleTime.isValid()) {
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "MediaDecoderReader.h"
|
||||
#include "mozilla/dom/AudioChannelBinding.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -116,7 +117,7 @@ private:
|
||||
const int64_t mStartTime;
|
||||
|
||||
// PCM frames written to the stream so far.
|
||||
int64_t mWritten;
|
||||
Atomic<int64_t> mWritten;
|
||||
|
||||
// Keep the last good position returned from the audio stream. Used to ensure
|
||||
// position returned by GetPosition() is mono-increasing in spite of audio
|
||||
|
Loading…
Reference in New Issue
Block a user