Bug 750769. Clarify that mNextState can only be PLAY_STATE_PAUSED or PLAY_STATE_PLAYING. r=cpearce

This commit is contained in:
Robert O'Callahan 2012-05-15 17:57:23 +12:00
parent cbe63bfaf7
commit f1893f0756
2 changed files with 5 additions and 9 deletions

View File

@ -446,23 +446,18 @@ void nsBuiltinDecoder::MetadataLoaded(PRUint32 aChannels,
return;
}
// Only inform the element of MetadataLoaded if not doing a load() in order
// to fulfill a seek, otherwise we'll get multiple metadataloaded events.
bool notifyElement = true;
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
mDuration = mDecoderStateMachine ? mDecoderStateMachine->GetDuration() : -1;
// Duration has changed so we should recompute playback rate
UpdatePlaybackRate();
notifyElement = mNextState != PLAY_STATE_SEEKING;
}
if (mDuration == -1) {
SetInfinite(true);
}
if (mElement && notifyElement) {
if (mElement) {
// Make sure the element and the frame (if any) are told about
// our new size.
Invalidate();
@ -482,7 +477,7 @@ void nsBuiltinDecoder::MetadataLoaded(PRUint32 aChannels,
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
bool resourceIsLoaded = !mResourceLoaded && mResource &&
mResource->IsDataCachedToEndOfResource(mDecoderPosition);
if (mElement && notifyElement) {
if (mElement) {
mElement->FirstFrameLoaded(resourceIsLoaded);
}
@ -568,7 +563,7 @@ void nsBuiltinDecoder::DecodeError()
bool nsBuiltinDecoder::IsSeeking() const
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
return mPlayState == PLAY_STATE_SEEKING || mNextState == PLAY_STATE_SEEKING;
return mPlayState == PLAY_STATE_SEEKING;
}
bool nsBuiltinDecoder::IsEnded() const

View File

@ -755,7 +755,8 @@ public:
// monitor. Thus, it can be safely read while holding the decoder monitor
// OR on the main thread.
// Any change to the state must call NotifyAll on the monitor.
PlayState mNextState;
// This can only be PLAY_STATE_PAUSED or PLAY_STATE_PLAYING.
PlayState mNextState;
// True when we have fully loaded the resource and reported that
// to the element (i.e. reached NETWORK_LOADED state).