Bug 1135170 - Route queued seeks back through MDSM::Seek and eliminate MDSM::StartSeek. r=mattwoodrow

This commit is contained in:
Bobby Holley 2015-02-20 11:05:56 -08:00
Родитель 82e85c92e2
Коммит 3b78e1ecfd
2 изменённых файлов: 11 добавлений и 44 удалений

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

@ -1713,41 +1713,6 @@ void MediaDecoderStateMachine::Seek(const SeekTarget& aTarget)
}
mQueuedSeekTarget.Reset();
StartSeek(aTarget);
}
void
MediaDecoderStateMachine::EnqueueStartQueuedSeekTask()
{
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::StartQueuedSeek);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
}
void
MediaDecoderStateMachine::StartQueuedSeek()
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
if (!mQueuedSeekTarget.IsValid()) {
return;
}
StartSeek(mQueuedSeekTarget);
mQueuedSeekTarget.Reset();
}
void
MediaDecoderStateMachine::StartSeek(const SeekTarget& aTarget)
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
AssertCurrentThreadInMonitor();
MOZ_ASSERT(mState >= DECODER_STATE_DECODING);
if (mState == DECODER_STATE_SHUTDOWN) {
return;
}
// Bound the seek time to be inside the media range.
int64_t end = GetEndTime();
NS_ASSERTION(mStartTime != -1, "Should know start time by now");
@ -1773,6 +1738,17 @@ MediaDecoderStateMachine::StartSeek(const SeekTarget& aTarget)
ScheduleStateMachine();
}
void
MediaDecoderStateMachine::EnqueueStartQueuedSeekTask()
{
MOZ_ASSERT(mQueuedSeekTarget.IsValid());
MOZ_ASSERT(mState >= DECODER_STATE_DECODING, "MDSM::Seek will requeue this seek!");
DECODER_LOG("Applying queued seek to %lld\n", mQueuedSeekTarget.mTime);
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethodWithArg<SeekTarget>(this, &MediaDecoderStateMachine::Seek, mQueuedSeekTarget);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
}
void MediaDecoderStateMachine::StopAudioThread()
{
// XXXbholley - Needed because DecodeSeek runs on the decode thread.

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

@ -228,15 +228,6 @@ public:
// This is threadsafe and can be called on any thread.
void EnqueueStartQueuedSeekTask();
// Seeks to the decoder to mQueuedSeekTarget asynchronously.
// Must be called from the main thread.
void StartQueuedSeek();
// Seeks to the decoder to aTarget asynchronously.
// Must be called from the main thread.
// The decoder monitor must be held with exactly one lock count.
void StartSeek(const SeekTarget& aTarget);
// Returns the current playback position in seconds.
// Called from the main thread to get the current frame time. The decoder
// monitor must be obtained before calling this.