Bug 1139256 - remove the assertion in AudioStream::GetPositionInFramesUnlocked(). See bug 1139256 comment 4 for the detail. r=kinetik.

This commit is contained in:
JW Wang 2015-11-02 21:26:12 +08:00
parent cec734c5f4
commit 32d2d557d7
3 changed files with 6 additions and 11 deletions

View File

@ -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<uint64_t>(mLastGoodPosition, INT64_MAX);
return std::min<uint64_t>(position, INT64_MAX);
}
bool

View File

@ -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;
};

View File

@ -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;