Bug 515552 - Enable in-monitor assertions in nsOggDecoder. r=chris.double

--HG--
extra : rebase_source : c494f75bd7cc1cf4b114b9ff497412fb1e3c1ce1
This commit is contained in:
Matthew Gregan 2009-09-22 12:11:10 +12:00
Родитель ce3025f762
Коммит 7518dee43b
1 изменённых файлов: 16 добавлений и 16 удалений

Просмотреть файл

@ -291,7 +291,7 @@ public:
PRBool HasAudio() PRBool HasAudio()
{ {
NS_ASSERTION(mState > DECODER_STATE_DECODING_METADATA, "HasAudio() called during invalid state"); NS_ASSERTION(mState > DECODER_STATE_DECODING_METADATA, "HasAudio() called during invalid state");
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "HasAudio() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
return mAudioTrack != -1; return mAudioTrack != -1;
} }
@ -974,7 +974,7 @@ void nsOggDecodeStateMachine::PlayFrame() {
void nsOggDecodeStateMachine::PlayVideo(FrameData* aFrame) void nsOggDecodeStateMachine::PlayVideo(FrameData* aFrame)
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "PlayVideo() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
if (aFrame && aFrame->mVideoHeader) { if (aFrame && aFrame->mVideoHeader) {
OggPlayVideoData* videoData = oggplay_callback_info_get_video_data(aFrame->mVideoHeader); OggPlayVideoData* videoData = oggplay_callback_info_get_video_data(aFrame->mVideoHeader);
@ -1009,7 +1009,7 @@ void nsOggDecodeStateMachine::PlayVideo(FrameData* aFrame)
void nsOggDecodeStateMachine::PlayAudio(FrameData* aFrame) void nsOggDecodeStateMachine::PlayAudio(FrameData* aFrame)
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "PlayAudio() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
if (!mAudioStream) if (!mAudioStream)
return; return;
@ -1018,7 +1018,7 @@ void nsOggDecodeStateMachine::PlayAudio(FrameData* aFrame)
void nsOggDecodeStateMachine::OpenAudioStream() void nsOggDecodeStateMachine::OpenAudioStream()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "OpenAudioStream() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
mAudioStream = new nsAudioStream(); mAudioStream = new nsAudioStream();
if (!mAudioStream) { if (!mAudioStream) {
LOG(PR_LOG_ERROR, ("Could not create audio stream")); LOG(PR_LOG_ERROR, ("Could not create audio stream"));
@ -1031,7 +1031,7 @@ void nsOggDecodeStateMachine::OpenAudioStream()
void nsOggDecodeStateMachine::CloseAudioStream() void nsOggDecodeStateMachine::CloseAudioStream()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "CloseAudioStream() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
if (mAudioStream) { if (mAudioStream) {
mAudioStream->Shutdown(); mAudioStream->Shutdown();
mAudioStream = nsnull; mAudioStream = nsnull;
@ -1040,7 +1040,7 @@ void nsOggDecodeStateMachine::CloseAudioStream()
void nsOggDecodeStateMachine::StartAudio() void nsOggDecodeStateMachine::StartAudio()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "StartAudio() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
if (HasAudio()) { if (HasAudio()) {
OpenAudioStream(); OpenAudioStream();
} }
@ -1048,7 +1048,7 @@ void nsOggDecodeStateMachine::StartAudio()
void nsOggDecodeStateMachine::StopAudio() void nsOggDecodeStateMachine::StopAudio()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "StopAudio() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
if (HasAudio()) { if (HasAudio()) {
CloseAudioStream(); CloseAudioStream();
} }
@ -1056,7 +1056,7 @@ void nsOggDecodeStateMachine::StopAudio()
void nsOggDecodeStateMachine::StartPlayback() void nsOggDecodeStateMachine::StartPlayback()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "StartPlayback() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
StartAudio(); StartAudio();
mPlaying = PR_TRUE; mPlaying = PR_TRUE;
@ -1078,7 +1078,7 @@ void nsOggDecodeStateMachine::StartPlayback()
void nsOggDecodeStateMachine::StopPlayback() void nsOggDecodeStateMachine::StopPlayback()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "StopPlayback() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
mLastFrame = mDecodedFrames.ResetTimes(mCallbackPeriod); mLastFrame = mDecodedFrames.ResetTimes(mCallbackPeriod);
StopAudio(); StopAudio();
mPlaying = PR_FALSE; mPlaying = PR_FALSE;
@ -1133,7 +1133,7 @@ void nsOggDecodeStateMachine::UpdatePlaybackPosition(float aTime)
void nsOggDecodeStateMachine::QueueDecodedFrames() void nsOggDecodeStateMachine::QueueDecodedFrames()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "QueueDecodedFrames() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
FrameData* frame; FrameData* frame;
while (!mDecodedFrames.IsFull() && (frame = NextFrame())) { while (!mDecodedFrames.IsFull() && (frame = NextFrame())) {
if (mDecodedFrames.GetCount() < 2) { if (mDecodedFrames.GetCount() < 2) {
@ -1152,13 +1152,13 @@ void nsOggDecodeStateMachine::QueueDecodedFrames()
void nsOggDecodeStateMachine::ClearPositionChangeFlag() void nsOggDecodeStateMachine::ClearPositionChangeFlag()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "ClearPositionChangeFlag() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
mPositionChangeQueued = PR_FALSE; mPositionChangeQueued = PR_FALSE;
} }
void nsOggDecodeStateMachine::SetVolume(float volume) void nsOggDecodeStateMachine::SetVolume(float volume)
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "SetVolume() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
if (mAudioStream) { if (mAudioStream) {
mAudioStream->SetVolume(volume); mAudioStream->SetVolume(volume);
} }
@ -1168,25 +1168,25 @@ void nsOggDecodeStateMachine::SetVolume(float volume)
float nsOggDecodeStateMachine::GetCurrentTime() float nsOggDecodeStateMachine::GetCurrentTime()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "GetCurrentTime() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
return mCurrentFrameTime; return mCurrentFrameTime;
} }
PRInt64 nsOggDecodeStateMachine::GetDuration() PRInt64 nsOggDecodeStateMachine::GetDuration()
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "GetDuration() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
return mDuration; return mDuration;
} }
void nsOggDecodeStateMachine::SetDuration(PRInt64 aDuration) void nsOggDecodeStateMachine::SetDuration(PRInt64 aDuration)
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "SetDuration() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
mDuration = aDuration; mDuration = aDuration;
} }
void nsOggDecodeStateMachine::SetSeekable(PRBool aSeekable) void nsOggDecodeStateMachine::SetSeekable(PRBool aSeekable)
{ {
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "SetSeekable() called without acquiring decoder monitor"); PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mDecoder->GetMonitor());
mSeekable = aSeekable; mSeekable = aSeekable;
} }