зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1336510 - Part 9: Avoid MediaDecoder shutdown hang due to unnecessary strong reference capture, r=jwwang
MozReview-Commit-ID: ElH27usjxlj
This commit is contained in:
Родитель
59878e7979
Коммит
1ef7419953
|
@ -2805,6 +2805,11 @@ bool MediaDecoderStateMachine::IsPlaying() const
|
|||
return mMediaSink->IsPlaying();
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::SetMediaNotSeekable()
|
||||
{
|
||||
mMediaSeekable = false;
|
||||
}
|
||||
|
||||
nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -2821,11 +2826,8 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
|
|||
|
||||
mMetadataManager.Connect(mReader->TimedMetadataEvent(), OwnerThread());
|
||||
|
||||
RefPtr<MediaDecoderStateMachine> self = this;
|
||||
mOnMediaNotSeekable = mReader->OnMediaNotSeekable().Connect(
|
||||
OwnerThread(), [self] () {
|
||||
self->mMediaSeekable = false;
|
||||
});
|
||||
OwnerThread(), this, &MediaDecoderStateMachine::SetMediaNotSeekable);
|
||||
|
||||
mMediaSink = CreateMediaSink(mAudioCaptured);
|
||||
|
||||
|
@ -2838,6 +2840,7 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoder* aDecoder)
|
|||
nsresult rv = mReader->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<MediaDecoderStateMachine> self = this;
|
||||
OwnerThread()->Dispatch(NS_NewRunnableFunction([self] () {
|
||||
MOZ_ASSERT(!self->mStateObj);
|
||||
auto s = new DecodeMetadataState(self);
|
||||
|
|
|
@ -297,6 +297,9 @@ private:
|
|||
// be held.
|
||||
bool IsPlaying() const;
|
||||
|
||||
// Sets mMediaSeekable to false.
|
||||
void SetMediaNotSeekable();
|
||||
|
||||
// Resets all states related to decoding and aborts all pending requests
|
||||
// to the decoders.
|
||||
void ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
|
||||
|
|
Загрузка…
Ссылка в новой задаче