Closed Bug 1272182 Opened 8 years ago Closed 8 years ago

loadedmetadata shouldn't be fired if we have no way of decoding the data

Categories

(Core :: Audio/Video: Playback, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jya, Assigned: jya)

References

Details

Attachments

(2 files)

Bug 1207198 changed the behaviour to accept media's metadata so long as we have a duration and dimensions.

This was changed as the loadedmetadata definition in the spec is:
"The user agent has just determined the duration and dimensions of the media resource and the text tracks are ready. "

however, in the list of actions to be performed prior changing the readyState and firing the loadedmetadata event, we can read:
https://w3c.github.io/html/semantics-embedded-content.html#media-data-processing-steps-list
"If the media data can be fetched but is found by inspection to be in an unsupported format, or can otherwise not be rendered at all "

So, we should check if we can actually decode the video tracks prior accepting the metadata.
Comment on attachment 8751557 [details]
MozReview Request: Bug 1272182: P1. Ignore invalid video tracks. r?cpearce

https://reviewboard.mozilla.org/r/52091/#review49015

::: dom/media/MediaFormatReader.cpp:301
(Diff revision 1)
> -    }
> +      }
> -    mVideo.mCallback = new DecoderCallback(this, TrackInfo::kVideoTrack);
> +      mVideo.mCallback = new DecoderCallback(this, TrackInfo::kVideoTrack);
> -    mVideo.mTimeRanges = mVideo.mTrackDemuxer->GetBuffered();
> +      mVideo.mTimeRanges = mVideo.mTrackDemuxer->GetBuffered();
> -    mTrackDemuxersMayBlock |= mVideo.mTrackDemuxer->GetSamplesMayBlock();
> +      mTrackDemuxersMayBlock |= mVideo.mTrackDemuxer->GetSamplesMayBlock();
> +    } else {
> +      mVideo.mTrackDemuxer->BreakCycles();

Other places that call m{Audio,Video}.mTrackDemuxer->BreakCycles() also call m{Audio,Video}.mTrackDemuxer m{Audio,Video}.ResetDemuxer(). Should you also be doing that here?
Attachment #8751557 - Flags: review?(cpearce) → review+
Comment on attachment 8751558 [details]
MozReview Request: Bug 1272182: P2. Reject upfront videos for which we have no decoder. r?cpearce

https://reviewboard.mozilla.org/r/52093/#review49017

::: dom/media/MediaFormatReader.cpp:306
(Diff revision 1)
> +      mMetadataPromise.Reject(ReadMetadataFailureReason::METADATA_ERROR, __func__);
> +      return;
> +    }
> +
>      if (videoActive) {
>        mInfo.mVideo = *videoInfo->GetAsVideoInfo();

You could nest the "platform && !platform->SupportsMimeType" check inside this videoActive check, to save checking it twice.

::: dom/media/MediaFormatReader.cpp:329
(Diff revision 1)
>        return;
>      }
> +
>      UniquePtr<TrackInfo> audioInfo = mAudio.mTrackDemuxer->GetInfo();
>      // We actively ignore audio tracks that we know we can't play.
>      audioActive = audioInfo && audioInfo->IsValid();

You could calculate the value of audioActive in one statement instead of two.
Attachment #8751558 - Flags: review?(cpearce) → review+
https://reviewboard.mozilla.org/r/52091/#review49015

> Other places that call m{Audio,Video}.mTrackDemuxer->BreakCycles() also call m{Audio,Video}.mTrackDemuxer m{Audio,Video}.ResetDemuxer(). Should you also be doing that here?

it will be done when the MFR will shutdown.

The only reason I had to shut down the track demuxer, is that HasAudio() and HasVideo() are actually return !!mAudio/mVideo.mTrackDemuxer
https://reviewboard.mozilla.org/r/52091/#review49015

> it will be done when the MFR will shutdown.
> 
> The only reason I had to shut down the track demuxer, is that HasAudio() and HasVideo() are actually return !!mAudio/mVideo.mTrackDemuxer

oh, and also, the trackdemuxer haven't been used yet. so no need to reset them
https://reviewboard.mozilla.org/r/52093/#review49017

> You could calculate the value of audioActive in one statement instead of two.

yeah, but then it makes it all go unto multiple line with extra parantheses; I figured it was clearer to read that way
Comment on attachment 8751558 [details]
MozReview Request: Bug 1272182: P2. Reject upfront videos for which we have no decoder. r?cpearce

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/52093/diff/1-2/
https://hg.mozilla.org/mozilla-central/rev/9673bccca574
https://hg.mozilla.org/mozilla-central/rev/45c56040ec81
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: