mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1139380: Ensure all queued tasks are aborted when shutting down. r=cpearce
This commit is contained in:
parent
ac2c26d8f4
commit
aff59a70fb
@ -836,6 +836,10 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType,
|
||||
} else {
|
||||
mVideoDataRequest.Complete();
|
||||
}
|
||||
if (IsShutdown()) {
|
||||
// Already shutdown;
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is a decode error, delegate to the generic error path.
|
||||
if (aReason == MediaDecoderReader::DECODE_ERROR) {
|
||||
@ -1927,6 +1931,10 @@ MediaDecoderStateMachine::DispatchAudioDecodeTaskIfNeeded()
|
||||
MOZ_ASSERT(OnStateMachineThread());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (IsShutdown()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NeedToDecodeAudio()) {
|
||||
return EnsureAudioDecodeTaskQueued();
|
||||
}
|
||||
@ -1973,6 +1981,10 @@ MediaDecoderStateMachine::DispatchVideoDecodeTaskIfNeeded()
|
||||
MOZ_ASSERT(OnStateMachineThread());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (IsShutdown()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NeedToDecodeVideo()) {
|
||||
return EnsureVideoDecodeTaskQueued();
|
||||
}
|
||||
|
@ -418,6 +418,14 @@ nsRefPtr<ShutdownPromise>
|
||||
MediaSourceReader::Shutdown()
|
||||
{
|
||||
mSeekPromise.RejectIfExists(NS_ERROR_FAILURE, __func__);
|
||||
// Any previous requests we've been waiting on are now unwanted.
|
||||
mAudioRequest.DisconnectIfExists();
|
||||
mVideoRequest.DisconnectIfExists();
|
||||
|
||||
// Additionally, reject any outstanding promises _we_ made that we might have
|
||||
// been waiting on the above to fulfill.
|
||||
mAudioPromise.RejectIfExists(CANCELED, __func__);
|
||||
mVideoPromise.RejectIfExists(CANCELED, __func__);
|
||||
|
||||
MOZ_ASSERT(mMediaSourceShutdownPromise.IsEmpty());
|
||||
nsRefPtr<ShutdownPromise> p = mMediaSourceShutdownPromise.Ensure(__func__);
|
||||
|
Loading…
Reference in New Issue
Block a user