зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1247056 - Notify MediaDecoder about Decoder Doctor events from MDSM - r=jwwang
MozReview-Commit-ID: Jgt5a2yJugu --HG-- extra : rebase_source : 2c8bfb9e7ce6dd69ef5a31b1737e5f314d14cad7
This commit is contained in:
Родитель
7368a3ff17
Коммит
2b00ac4132
|
@ -607,6 +607,7 @@ MediaDecoder::Shutdown()
|
|||
mFirstFrameLoadedListener.Disconnect();
|
||||
mOnPlaybackEvent.Disconnect();
|
||||
mOnPlaybackErrorEvent.Disconnect();
|
||||
mOnDecoderDoctorEvent.Disconnect();
|
||||
mOnMediaNotSeekable.Disconnect();
|
||||
|
||||
mDecoderStateMachine->BeginShutdown()
|
||||
|
@ -679,6 +680,24 @@ MediaDecoder::OnPlaybackErrorEvent(const MediaResult& aError)
|
|||
DecodeError(aError);
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::OnDecoderDoctorEvent(DecoderDoctorEvent aEvent)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
// OnDecoderDoctorEvent is disconnected at shutdown time.
|
||||
MOZ_ASSERT(!IsShutdown());
|
||||
HTMLMediaElement* element = mOwner->GetMediaElement();
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
nsIDocument* doc = element->OwnerDoc();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
DecoderDoctorDiagnostics diags;
|
||||
diags.StoreEvent(doc, aEvent, __func__);
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::FinishShutdown()
|
||||
{
|
||||
|
@ -757,6 +776,8 @@ MediaDecoder::SetStateMachineParameters()
|
|||
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackEvent);
|
||||
mOnPlaybackErrorEvent = mDecoderStateMachine->OnPlaybackErrorEvent().Connect(
|
||||
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackErrorEvent);
|
||||
mOnDecoderDoctorEvent = mDecoderStateMachine->OnDecoderDoctorEvent().Connect(
|
||||
AbstractThread::MainThread(), this, &MediaDecoder::OnDecoderDoctorEvent);
|
||||
mOnMediaNotSeekable = mDecoderStateMachine->OnMediaNotSeekable().Connect(
|
||||
AbstractThread::MainThread(), this, &MediaDecoder::OnMediaNotSeekable);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsITimer.h"
|
||||
|
||||
#include "AbstractMediaDecoder.h"
|
||||
#include "DecoderDoctorDiagnostics.h"
|
||||
#include "MediaDecoderOwner.h"
|
||||
#include "MediaEventSource.h"
|
||||
#include "MediaMetadataManager.h"
|
||||
|
@ -594,6 +595,8 @@ private:
|
|||
void OnPlaybackEvent(MediaEventType aEvent);
|
||||
void OnPlaybackErrorEvent(const MediaResult& aError);
|
||||
|
||||
void OnDecoderDoctorEvent(DecoderDoctorEvent aEvent);
|
||||
|
||||
void OnMediaNotSeekable()
|
||||
{
|
||||
SetMediaSeekable(false);
|
||||
|
@ -733,6 +736,7 @@ protected:
|
|||
|
||||
MediaEventListener mOnPlaybackEvent;
|
||||
MediaEventListener mOnPlaybackErrorEvent;
|
||||
MediaEventListener mOnDecoderDoctorEvent;
|
||||
MediaEventListener mOnMediaNotSeekable;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -2877,9 +2877,13 @@ void MediaDecoderStateMachine::OnMediaSinkAudioComplete()
|
|||
mAudioCompleted = true;
|
||||
// To notify PlaybackEnded as soon as possible.
|
||||
ScheduleStateMachine();
|
||||
|
||||
// Report OK to Decoder Doctor (to know if issue may have been resolved).
|
||||
mOnDecoderDoctorEvent.Notify(
|
||||
DecoderDoctorEvent{DecoderDoctorEvent::eAudioSinkStartup, NS_OK});
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::OnMediaSinkAudioError()
|
||||
void MediaDecoderStateMachine::OnMediaSinkAudioError(nsresult aResult)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
MOZ_ASSERT(mInfo.HasAudio());
|
||||
|
@ -2888,6 +2892,11 @@ void MediaDecoderStateMachine::OnMediaSinkAudioError()
|
|||
mMediaSinkAudioPromise.Complete();
|
||||
mAudioCompleted = true;
|
||||
|
||||
// Result should never be NS_OK in this *error* handler. Report to Dec-Doc.
|
||||
MOZ_ASSERT(NS_FAILED(aResult));
|
||||
mOnDecoderDoctorEvent.Notify(
|
||||
DecoderDoctorEvent{DecoderDoctorEvent::eAudioSinkStartup, aResult});
|
||||
|
||||
// Make the best effort to continue playback when there is video.
|
||||
if (HasVideo()) {
|
||||
return;
|
||||
|
|
|
@ -253,6 +253,9 @@ public:
|
|||
MediaEventSource<MediaResult>&
|
||||
OnPlaybackErrorEvent() { return mOnPlaybackErrorEvent; }
|
||||
|
||||
MediaEventSource<DecoderDoctorEvent>&
|
||||
OnDecoderDoctorEvent() { return mOnDecoderDoctorEvent; }
|
||||
|
||||
size_t SizeOfVideoQueue() const;
|
||||
|
||||
size_t SizeOfAudioQueue() const;
|
||||
|
@ -561,7 +564,7 @@ private:
|
|||
void OnMediaSinkVideoComplete();
|
||||
|
||||
// Rejected by the MediaSink to signal errors for audio/video.
|
||||
void OnMediaSinkAudioError();
|
||||
void OnMediaSinkAudioError(nsresult aResult);
|
||||
void OnMediaSinkVideoError();
|
||||
|
||||
// Return true if the video decoder's decode speed can not catch up the
|
||||
|
@ -864,6 +867,8 @@ private:
|
|||
MediaEventProducer<MediaEventType> mOnPlaybackEvent;
|
||||
MediaEventProducer<MediaResult> mOnPlaybackErrorEvent;
|
||||
|
||||
MediaEventProducer<DecoderDoctorEvent> mOnDecoderDoctorEvent;
|
||||
|
||||
// True if audio is offloading.
|
||||
// Playback will not start when audio is offloading.
|
||||
bool mAudioOffloading;
|
||||
|
|
Загрузка…
Ссылка в новой задаче