mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1160695 - Make MediaDecoder::DurationChanged take a duration argument rather than reading it back synchronously from the MDSM. r=jww
This commit is contained in:
parent
b109b7040a
commit
6f9facd3ca
@ -1067,12 +1067,12 @@ void MediaDecoder::UpdateLogicalPosition(MediaDecoderEventVisibility aEventVisib
|
||||
}
|
||||
}
|
||||
|
||||
void MediaDecoder::DurationChanged()
|
||||
void MediaDecoder::DurationChanged(TimeUnit aNewDuration)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
int64_t oldDuration = mDuration;
|
||||
mDuration = mDecoderStateMachine ? mDecoderStateMachine->GetDuration() : -1;
|
||||
mDuration = aNewDuration.ToMicroseconds();
|
||||
// Duration has changed so we should recompute playback rate
|
||||
UpdatePlaybackRate();
|
||||
|
||||
|
@ -520,7 +520,7 @@ public:
|
||||
|
||||
// Called by the state machine to notify the decoder that the duration
|
||||
// has changed.
|
||||
void DurationChanged();
|
||||
void DurationChanged(media::TimeUnit aNewDuration);
|
||||
|
||||
bool OnStateMachineTaskQueue() const override;
|
||||
|
||||
|
@ -1352,7 +1352,8 @@ void MediaDecoderStateMachine::UpdatePlaybackPositionInternal(int64_t aTime)
|
||||
DECODER_LOG("Setting new end time to %lld", aTime);
|
||||
mEndTime = aTime;
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(mDecoder, &MediaDecoder::DurationChanged);
|
||||
NS_NewRunnableMethodWithArg<TimeUnit>(mDecoder, &MediaDecoder::DurationChanged,
|
||||
TimeUnit::FromMicroseconds(GetDuration()));
|
||||
AbstractThread::MainThread()->Dispatch(event.forget());
|
||||
}
|
||||
}
|
||||
@ -1517,7 +1518,8 @@ void MediaDecoderStateMachine::UpdateEstimatedDuration(int64_t aDuration)
|
||||
mozilla::Abs(aDuration - duration) > ESTIMATED_DURATION_FUZZ_FACTOR_USECS) {
|
||||
SetDuration(aDuration);
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(mDecoder, &MediaDecoder::DurationChanged);
|
||||
NS_NewRunnableMethodWithArg<TimeUnit>(mDecoder, &MediaDecoder::DurationChanged,
|
||||
TimeUnit::FromMicroseconds(GetDuration()));
|
||||
AbstractThread::MainThread()->Dispatch(event.forget());
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ extern PRLogModuleInfo* GetMediaSourceLog();
|
||||
#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
|
||||
using namespace mozilla::media;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class SourceBufferDecoder;
|
||||
@ -210,7 +212,7 @@ MediaSourceDecoder::SetMediaSourceDuration(double aDuration, MSRangeRemovalActio
|
||||
mReader->SetMediaSourceDuration(mMediaSourceDuration);
|
||||
}
|
||||
|
||||
MediaDecoder::DurationChanged();
|
||||
MediaDecoder::DurationChanged(TimeUnit::FromSeconds(mMediaSourceDuration));
|
||||
if (mMediaSource && aAction != MSRangeRemovalAction::SKIP) {
|
||||
mMediaSource->DurationChange(oldDuration, aDuration);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user