Closed Bug 871804 Opened 11 years ago Closed 11 years ago

CanPlayType doesn't report that it can play all the H.264 profile levels that WMF can play

Categories

(Core :: Audio/Video, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: cpearce, Assigned: cpearce)

References

Details

Attachments

(1 file)

"The Media Foundation H.264 video decoder is a Media Foundation Transform that supports decoding of Baseline, Main, and High profiles, up to level 5.1."

http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815%28v=vs.85%29.aspx

But we're only reporting that we can play up to Level 3.1:
http://mxr.mozilla.org/mozilla-central/source/content/media/wmf/WMFDecoder.cpp#84

We should report that we can play the levels that we can play.
See also bug 875573; we should consider also supporting MIME-type video/x-m4v.
Blocks: 875573, 799315
Attached patch Patch (deleted) — Splinter Review
Parse the avc1 codecs parameter, and report that we can play Base, Main, Extended, and High profiles up to 5.1, in WMFDecoder.

WMF's H.264 Decoder's documentation doesn't explicitly say that it can play Extended, but there are bitstreams that are Extended compliant that are Baseline compliant, and we previously reported that we could play Extended and no one complained. I can't find a tool to explicitly encode to Extended, so I can't test this. So I suggest we report that we can play Extended until someone proves we can't.

With this patch the YouTube MSE demo player loads on Windows 8, though there's some buffering problem that kft said you were already aware of Matthew.

test_can_play_type_mpeg.html passes locally.
Assignee: nobody → cpearce
Status: NEW → ASSIGNED
Attachment #831786 - Flags: review?(kinetik)
Comment on attachment 831786 [details] [diff] [review]
Patch

Review of attachment 831786 [details] [diff] [review]:
-----------------------------------------------------------------

Awesome.

::: content/media/wmf/WMFDecoder.cpp
@@ +71,5 @@
> +  // documentation what constraints the WMF H.264 decoder supports.
> +  // See http://blog.pearce.org.nz/2013/11/what-does-h264avc1-codecs-parameters.html
> +  // for more details.
> +  static const int SamplePatternLength = 11; // strlen("avc1.PPCCLL")
> +  if (aCodec.Length() != SamplePatternLength) {

Make this:

    if (aCodec.Length() != strlen("avc1.PPCCLL") {

Slightly more robust if it's changed later, and the any decent compiler will optimize that strlen to a const (verified with gcc -O2).

@@ +85,5 @@
> +  // Extract the profile_idc and level_idc. Note: the constraint_set flags
> +  // are ignored, it's not clear from the WMF documentation if they make a
> +  // difference.
> +  nsresult rv = NS_OK;
> +  const int profile = PromiseFlatString(Substring(aCodec, 5, 2)).ToInteger(&rv, 16);

int32_t to match return type.

@@ +88,5 @@
> +  nsresult rv = NS_OK;
> +  const int profile = PromiseFlatString(Substring(aCodec, 5, 2)).ToInteger(&rv, 16);
> +  NS_ENSURE_SUCCESS(rv, false);
> +
> +  const int level = PromiseFlatString(Substring(aCodec, 9, 2)).ToInteger(&rv, 16);

Ditto.

@@ +134,5 @@
> +  while (tokenizer.hasMoreTokens()) {
> +    const nsSubstring& token = tokenizer.nextToken();
> +    expectMoreTokens = tokenizer.separatorAfterCurrentToken();
> +    if (token.EqualsASCII("mp4a.40.2") || // AAC-LC
> +        IsSupportedH264Codec(token)) {      

Tailing whitespace.
Attachment #831786 - Flags: review?(kinetik) → review+
https://hg.mozilla.org/mozilla-central/rev/ad2f0f62320b
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Depends on: 940293
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: