Bug 1178437 - Dispatch SetFragmentEndTime. r=jww

This commit is contained in:
Bobby Holley 2015-06-29 12:00:03 -07:00
parent 6a5325c7f8
commit 90a2ee4218
3 changed files with 9 additions and 10 deletions

View File

@ -1153,8 +1153,7 @@ void MediaDecoder::SetFragmentEndTime(double aTime)
{
MOZ_ASSERT(NS_IsMainThread());
if (mDecoderStateMachine) {
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mDecoderStateMachine->SetFragmentEndTime(static_cast<int64_t>(aTime * USECS_PER_S));
mDecoderStateMachine->DispatchSetFragmentEndTime(static_cast<int64_t>(aTime * USECS_PER_S));
}
}

View File

@ -1426,13 +1426,6 @@ void MediaDecoderStateMachine::RecomputeDuration()
mDuration = Some(duration);
}
void MediaDecoderStateMachine::SetFragmentEndTime(int64_t aEndTime)
{
AssertCurrentThreadInMonitor();
mFragmentEndTime = aEndTime < 0 ? aEndTime : aEndTime;
}
bool MediaDecoderStateMachine::IsDormantNeeded()
{
return mReader->IsDormantNeeded();

View File

@ -306,7 +306,14 @@ public:
void NotReached() { MOZ_DIAGNOSTIC_ASSERT(false); }
// Set the media fragment end time. aEndTime is in microseconds.
void SetFragmentEndTime(int64_t aEndTime);
void DispatchSetFragmentEndTime(int64_t aEndTime)
{
nsRefPtr<MediaDecoderStateMachine> self = this;
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self, aEndTime] () {
self->mFragmentEndTime = aEndTime;
});
TaskQueue()->Dispatch(r.forget());
}
// Drop reference to decoder. Only called during shutdown dance.
void BreakCycles() {