From 32d2d557d712200fd160e91d03915f7d4866412f Mon Sep 17 00:00:00 2001 From: JW Wang Date: Mon, 2 Nov 2015 21:26:12 +0800 Subject: [PATCH] Bug 1139256 - remove the assertion in AudioStream::GetPositionInFramesUnlocked(). See bug 1139256 comment 4 for the detail. r=kinetik. --- dom/media/AudioStream.cpp | 8 +------- dom/media/AudioStream.h | 3 --- dom/media/mediasink/DecodedAudioDataSink.cpp | 6 +++++- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index 4a93b25978a0..2277b37b5cd5 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -130,7 +130,6 @@ AudioStream::AudioStream() , mDumpFile(nullptr) , mBytesPerFrame(0) , mState(INITIALIZED) - , mLastGoodPosition(0) , mIsMonoAudioEnabled(gfxPrefs::MonoAudio()) { } @@ -622,12 +621,7 @@ AudioStream::GetPositionInFramesUnlocked() } } - MOZ_ASSERT(position >= mLastGoodPosition, "cubeb position shouldn't go backward"); - // This error handling/recovery keeps us in good shape in release build. - if (position >= mLastGoodPosition) { - mLastGoodPosition = position; - } - return std::min(mLastGoodPosition, INT64_MAX); + return std::min(position, INT64_MAX); } bool diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index e444540ff9ab..dc84feaf63bd 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -322,9 +322,6 @@ private: StreamState mState; bool mIsFirst; - // The last good position returned by cubeb_stream_get_position(). Used to - // check if the cubeb position is going backward. - uint64_t mLastGoodPosition; // Get this value from the preferece, if true, we would downmix the stereo. bool mIsMonoAudioEnabled; }; diff --git a/dom/media/mediasink/DecodedAudioDataSink.cpp b/dom/media/mediasink/DecodedAudioDataSink.cpp index 166f39c3b639..9953fb2ebefe 100644 --- a/dom/media/mediasink/DecodedAudioDataSink.cpp +++ b/dom/media/mediasink/DecodedAudioDataSink.cpp @@ -143,8 +143,12 @@ DecodedAudioDataSink::GetPosition() int64_t pos; if (mAudioStream && (pos = mAudioStream->GetPosition()) >= 0) { + NS_ASSERTION(pos >= mLastGoodPosition, + "AudioStream position shouldn't go backward"); // Update the last good position when we got a good one. - mLastGoodPosition = pos; + if (pos >= mLastGoodPosition) { + mLastGoodPosition = pos; + } } return mStartTime + mLastGoodPosition;