зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1299072: P9. Pass decoding error details to MediaDecoder. r=jwwang
MozReview-Commit-ID: uXWHhTozon --HG-- extra : rebase_source : 7736b9d969dc680b08bffbc7610271d5cc0272be
This commit is contained in:
Родитель
f9b88ac91f
Коммит
00e8a7dabc
|
@ -198,7 +198,7 @@ MediaDecoder::ResourceCallback::NotifyDecodeError()
|
|||
RefPtr<ResourceCallback> self = this;
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
|
||||
if (self->mDecoder) {
|
||||
self->mDecoder->DecodeError();
|
||||
self->mDecoder->DecodeError(NS_ERROR_DOM_MEDIA_FATAL_ERR);
|
||||
}
|
||||
});
|
||||
AbstractThread::MainThread()->Dispatch(r.forget());
|
||||
|
@ -607,6 +607,7 @@ MediaDecoder::Shutdown()
|
|||
mMetadataLoadedListener.Disconnect();
|
||||
mFirstFrameLoadedListener.Disconnect();
|
||||
mOnPlaybackEvent.Disconnect();
|
||||
mOnPlaybackErrorEvent.Disconnect();
|
||||
mOnMediaNotSeekable.Disconnect();
|
||||
|
||||
mDecoderStateMachine->BeginShutdown()
|
||||
|
@ -661,9 +662,6 @@ MediaDecoder::OnPlaybackEvent(MediaEventType aEvent)
|
|||
case MediaEventType::SeekStarted:
|
||||
SeekingStarted();
|
||||
break;
|
||||
case MediaEventType::DecodeError:
|
||||
DecodeError();
|
||||
break;
|
||||
case MediaEventType::Invalidate:
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -676,6 +674,12 @@ MediaDecoder::OnPlaybackEvent(MediaEventType aEvent)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::OnPlaybackErrorEvent(const MediaResult& aError)
|
||||
{
|
||||
DecodeError(aError);
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::FinishShutdown()
|
||||
{
|
||||
|
@ -749,6 +753,8 @@ MediaDecoder::SetStateMachineParameters()
|
|||
|
||||
mOnPlaybackEvent = mDecoderStateMachine->OnPlaybackEvent().Connect(
|
||||
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackEvent);
|
||||
mOnPlaybackErrorEvent = mDecoderStateMachine->OnPlaybackErrorEvent().Connect(
|
||||
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackErrorEvent);
|
||||
mOnMediaNotSeekable = mDecoderStateMachine->OnMediaNotSeekable().Connect(
|
||||
AbstractThread::MainThread(), this, &MediaDecoder::OnMediaNotSeekable);
|
||||
}
|
||||
|
@ -1006,7 +1012,7 @@ MediaDecoder::NetworkError()
|
|||
}
|
||||
|
||||
void
|
||||
MediaDecoder::DecodeError()
|
||||
MediaDecoder::DecodeError(const MediaResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!IsShutdown());
|
||||
|
|
|
@ -436,7 +436,7 @@ private:
|
|||
int64_t GetDownloadPosition();
|
||||
|
||||
// Notifies the element that decoding has failed.
|
||||
void DecodeError();
|
||||
void DecodeError(const MediaResult& aError);
|
||||
|
||||
// Indicate whether the media is same-origin with the element.
|
||||
void UpdateSameOriginStatus(bool aSameOrigin);
|
||||
|
@ -592,6 +592,7 @@ private:
|
|||
DataArrivedEvent() override { return &mDataArrivedEvent; }
|
||||
|
||||
void OnPlaybackEvent(MediaEventType aEvent);
|
||||
void OnPlaybackErrorEvent(const MediaResult& aError);
|
||||
|
||||
void OnMediaNotSeekable()
|
||||
{
|
||||
|
@ -731,6 +732,7 @@ protected:
|
|||
MediaEventListener mFirstFrameLoadedListener;
|
||||
|
||||
MediaEventListener mOnPlaybackEvent;
|
||||
MediaEventListener mOnPlaybackErrorEvent;
|
||||
MediaEventListener mOnMediaNotSeekable;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -1022,7 +1022,7 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType,
|
|||
|
||||
// If this is a decode error, delegate to the generic error path.
|
||||
if (aError != NS_ERROR_DOM_MEDIA_END_OF_STREAM) {
|
||||
DecodeError();
|
||||
DecodeError(aError);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2082,7 +2082,7 @@ MediaDecoderStateMachine::OnSeekTaskRejected(SeekTaskRejectValue aValue)
|
|||
StopPrerollingVideo();
|
||||
}
|
||||
|
||||
DecodeError();
|
||||
DecodeError(aValue.mError);
|
||||
|
||||
DiscardSeekTaskIfExist();
|
||||
}
|
||||
|
@ -2291,13 +2291,13 @@ bool MediaDecoderStateMachine::HasLowUndecodedData(int64_t aUsecs)
|
|||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::DecodeError()
|
||||
MediaDecoderStateMachine::DecodeError(const MediaResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
MOZ_ASSERT(!IsShutdown());
|
||||
DECODER_WARN("Decode error");
|
||||
// Notify the decode error and MediaDecoder will shut down MDSM.
|
||||
mOnPlaybackEvent.Notify(MediaEventType::DecodeError);
|
||||
mOnPlaybackErrorEvent.Notify(aError);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2918,7 +2918,7 @@ MediaDecoderStateMachine::OnMediaSinkVideoError()
|
|||
if (HasAudio()) {
|
||||
return;
|
||||
}
|
||||
DecodeError();
|
||||
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::OnMediaSinkAudioComplete()
|
||||
|
@ -2949,7 +2949,7 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError()
|
|||
|
||||
// Otherwise notify media decoder/element about this error for it makes
|
||||
// no sense to play an audio-only file without sound output.
|
||||
DecodeError();
|
||||
DecodeError(MediaResult(NS_ERROR_DOM_MEDIA_MEDIASINK_ERR, __func__));
|
||||
}
|
||||
|
||||
#ifdef MOZ_EME
|
||||
|
|
|
@ -119,7 +119,6 @@ enum class MediaEventType : int8_t {
|
|||
PlaybackStopped,
|
||||
PlaybackEnded,
|
||||
SeekStarted,
|
||||
DecodeError,
|
||||
Invalidate,
|
||||
EnterVideoSuspend,
|
||||
ExitVideoSuspend
|
||||
|
@ -245,6 +244,8 @@ public:
|
|||
|
||||
MediaEventSource<MediaEventType>&
|
||||
OnPlaybackEvent() { return mOnPlaybackEvent; }
|
||||
MediaEventSource<MediaResult>&
|
||||
OnPlaybackErrorEvent() { return mOnPlaybackErrorEvent; }
|
||||
|
||||
size_t SizeOfVideoQueue() const;
|
||||
|
||||
|
@ -481,7 +482,7 @@ protected:
|
|||
// event to the media element. This begins shutting down the decoder.
|
||||
// The decoder monitor must be held. This is only called on the
|
||||
// decode thread.
|
||||
void DecodeError();
|
||||
void DecodeError(const MediaResult& aError);
|
||||
|
||||
// Dispatches a LoadedMetadataEvent.
|
||||
// This is threadsafe and can be called on any thread.
|
||||
|
@ -892,6 +893,7 @@ private:
|
|||
MediaDecoderEventVisibility> mFirstFrameLoadedEvent;
|
||||
|
||||
MediaEventProducer<MediaEventType> mOnPlaybackEvent;
|
||||
MediaEventProducer<MediaResult> mOnPlaybackErrorEvent;
|
||||
|
||||
// True if audio is offloading.
|
||||
// Playback will not start when audio is offloading.
|
||||
|
|
Загрузка…
Ссылка в новой задаче