Bug 1343437 - TBM::OnDemuxer{Init,Reset}Done forward non-NS_OK MediaResult to HTMLMediaElement::DecodeWarning - r=jya

Similarly to the MediaFormatReader, TrackBuffersManager can forward warnings
from the demuxer initialization to the associated HTMLMediaElement.

Note that errors (sent to OnDemuxerInitFailed) are currently *not* forwarded
to the HTMLMediaElement by design. In the future, we may want to add this
feature so that mediasource errors can also be reported to webcompat.

MozReview-Commit-ID: GjluZbpmC9q

--HG--
extra : rebase_source : 57c02f86c56f054f209094d9697209300acc1288
This commit is contained in:
Gerald Squelart 2017-03-14 01:08:39 +11:00
Родитель f717376fb5
Коммит 7dca1275ff
2 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -854,7 +854,7 @@ TrackBuffersManager::ResetDemuxingState()
}
void
TrackBuffersManager::OnDemuxerResetDone(nsresult)
TrackBuffersManager::OnDemuxerResetDone(const MediaResult& aResult)
{
MOZ_ASSERT(OnTaskQueue());
mDemuxerInitRequest.Complete();
@ -862,6 +862,15 @@ TrackBuffersManager::OnDemuxerResetDone(nsresult)
// request was being processed. See bug 1239983.
MOZ_DIAGNOSTIC_ASSERT(mInputDemuxer);
if (aResult != NS_OK && mParentDecoder) {
RefPtr<TrackBuffersManager> self = this;
mAbstractMainThread->Dispatch(NS_NewRunnableFunction([self, aResult] () {
if (self->mParentDecoder && self->mParentDecoder->GetOwner()) {
self->mParentDecoder->GetOwner()->DecodeWarning(aResult);
}
}));
}
// Recreate track demuxers.
uint32_t numVideos = mInputDemuxer->GetNumberTracks(TrackInfo::kVideoTrack);
if (numVideos) {
@ -940,7 +949,7 @@ TrackBuffersManager::InitializationSegmentReceived()
}
void
TrackBuffersManager::OnDemuxerInitDone(nsresult)
TrackBuffersManager::OnDemuxerInitDone(const MediaResult& aResult)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_DIAGNOSTIC_ASSERT(mInputDemuxer, "mInputDemuxer has been destroyed");
@ -1132,6 +1141,15 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
SetAppendState(AppendState::WAITING_FOR_SEGMENT);
// 5. Jump to the loop top step above.
ScheduleSegmentParserLoop();
if (aResult != NS_OK && mParentDecoder) {
RefPtr<TrackBuffersManager> self = this;
mAbstractMainThread->Dispatch(NS_NewRunnableFunction([self, aResult] () {
if (self->mParentDecoder && self->mParentDecoder->GetOwner()) {
self->mParentDecoder->GetOwner()->DecodeWarning(aResult);
}
}));
}
}
void

Просмотреть файл

@ -237,9 +237,9 @@ private:
uint64_t mProcessedInput;
Maybe<media::TimeUnit> mLastParsedEndTime;
void OnDemuxerInitDone(nsresult);
void OnDemuxerInitDone(const MediaResult& aResult);
void OnDemuxerInitFailed(const MediaResult& aFailure);
void OnDemuxerResetDone(nsresult);
void OnDemuxerResetDone(const MediaResult& aResult);
MozPromiseRequestHolder<MediaDataDemuxer::InitPromise> mDemuxerInitRequest;
void OnDemuxFailed(TrackType aTrack, const MediaResult& aError);