author | Bobby Holley <bobbyholley@gmail.com> |
Fri, 16 Jan 2015 10:58:00 -0800 | |
changeset 224249 | a011bfe9487aefbe1962346fc3dc1700cf207442 |
parent 224248 | 552b8f18897cc3bbe737b6e96139666ae50f35b5 |
child 224250 | 5609699a8076948c76a74c50c313fa2ca4727fe4 |
push id | 54170 |
push user | bobbyholley@gmail.com |
push date | Fri, 16 Jan 2015 18:58:13 +0000 |
treeherder | mozilla-inbound@3d0dd2ae7e6c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mattwoodrow, cpearce |
bugs | 1121692 |
milestone | 38.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1910,34 +1910,24 @@ MediaDecoderStateMachine::DispatchDecode nsresult MediaDecoderStateMachine::EnqueueDecodeSeekTask() { NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(), "Should be on state machine or decode thread."); AssertCurrentThreadInMonitor(); - if (mState != DECODER_STATE_SEEKING || - !mSeekTarget.IsValid() || - mCurrentSeekTarget.IsValid()) { - return NS_OK; - } - mCurrentSeekTarget = mSeekTarget; - mSeekTarget.Reset(); - mDropAudioUntilNextDiscontinuity = HasAudio(); - mDropVideoUntilNextDiscontinuity = HasVideo(); - RefPtr<nsIRunnable> task( NS_NewRunnableMethod(this, &MediaDecoderStateMachine::DecodeSeek)); nsresult rv = DecodeTaskQueue()->Dispatch(task); if (NS_FAILED(rv)) { DECODER_WARN("Dispatch DecodeSeek task failed."); - mCurrentSeekTarget.Reset(); DecodeError(); } + return rv; } nsresult MediaDecoderStateMachine::DispatchAudioDecodeTaskIfNeeded() { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(), @@ -2384,20 +2374,29 @@ MediaDecoderStateMachine::FinishDecodeFi return NS_OK; } void MediaDecoderStateMachine::DecodeSeek() { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); NS_ASSERTION(OnDecodeThread(), "Should be on decode thread."); - if (mState != DECODER_STATE_SEEKING) { + + if (mState != DECODER_STATE_SEEKING || + !mSeekTarget.IsValid() || + mCurrentSeekTarget.IsValid()) { + DECODER_LOG("Early returning from DecodeSeek"); return; } + mCurrentSeekTarget = mSeekTarget; + mSeekTarget.Reset(); + mDropAudioUntilNextDiscontinuity = HasAudio(); + mDropVideoUntilNextDiscontinuity = HasVideo(); + // During the seek, don't have a lock on the decoder state, // otherwise long seek operations can block the main thread. // The events dispatched to the main thread are SYNC calls. // These calls are made outside of the decode monitor lock so // it is safe for the main thread to makes calls that acquire // the lock since it won't deadlock. We check the state when // acquiring the lock again in case shutdown has occurred // during the time when we didn't have the lock.