Bug 130275

Summary: Provide preference to enable additional AVFoundation options
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: MediaAssignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, calvaris, commit-queue, eric.carlson, esprehn+autocc, glenn, gyuyoung.kim, jer.noble, philipj, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Updated to handle Windows.
none
Patch
none
Patch
none
Patch
none
Finalized after testing. eric.carlson: review+

Description Brent Fulgham 2014-03-14 17:37:09 PDT
Add a new preference and attribute to allow WebKit to tell AVFoundation to turn on additional processing during playback.
Comment 1 Brent Fulgham 2014-03-14 21:10:27 PDT
Created attachment 226802 [details]
Patch
Comment 2 Brent Fulgham 2014-03-14 21:12:16 PDT
Comment on attachment 226802 [details]
Patch

Initial WIP. Checking Windows build.
Comment 3 Brent Fulgham 2014-03-14 23:04:01 PDT
Created attachment 226810 [details]
Patch
Comment 4 Jon Lee 2014-03-15 00:28:21 PDT
Comment on attachment 226810 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226810&action=review

Where's WebKit2?

> Source/WebCore/html/HTMLMediaElement.cpp:5986
> +    return true;

This logic, while correct, seems a bit odd to me. Why check for the attribute first before the setting, rather than the other way around?

> Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:2
> + * Copyright (C) 2011-2014 Apple Inc. All rights reserved.

I think proper style was to list individual years separately than a range…?

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:589
> +    

Please remove.

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:617
> +        [options.get() setObject: [NSNumber numberWithBool: TRUE] forKey: AVURLAssetInheritURIQueryComponentFromReferencingURIKey];

no space after ":"
Comment 5 Brent Fulgham 2014-03-15 10:37:52 PDT
Created attachment 226824 [details]
Updated to handle Windows.
Comment 6 Brent Fulgham 2014-03-15 10:49:23 PDT
Comment on attachment 226810 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226810&action=review

>> Source/WebCore/html/HTMLMediaElement.cpp:5986
>> +    return true;
> 
> This logic, while correct, seems a bit odd to me. Why check for the attribute first before the setting, rather than the other way around?

After talking with Jer, we decided to make this a generic method that could check for arbitrary attributes, not just this specific case we are dealing with today. If the attribute doesn't exist, it doesn't really matter if the setting is turned off since the result is the same. But if the setting does exist, we only need to check the setting for this specific URI case.

I'm not strongly attached to this; I could switch the order if you prefer.

>> Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:2
>> + * Copyright (C) 2011-2014 Apple Inc. All rights reserved.
> 
> I think proper style was to list individual years separately than a range…?

Darin told me in a recent review that we should use ranges.

> Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:255
> +static CFStringRef AVCFURLAssetInheritURIQueryComponentFromReferencingURIKey()

Note: This isn't needed and is removed in an updated patch.

>> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:589
>> +    
> 
> Please remove.

Will do.

>> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:617
>> +        [options.get() setObject: [NSNumber numberWithBool: TRUE] forKey: AVURLAssetInheritURIQueryComponentFromReferencingURIKey];
> 
> no space after ":"

Will do.
Comment 7 Brent Fulgham 2014-03-15 10:51:09 PDT
(In reply to comment #4)
> (From update of attachment 226810 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=226810&action=review
> 
> Where's WebKit2?

I'll review this on Mac after the servers are back up. I believe the preference logic is auto generated based on the Settings.in file.
Comment 8 Brent Fulgham 2014-03-16 21:27:00 PDT
Created attachment 226875 [details]
Patch
Comment 9 Brent Fulgham 2014-03-16 21:42:34 PDT
Created attachment 226878 [details]
Patch
Comment 10 Eric Carlson 2014-03-16 21:57:04 PDT
Comment on attachment 226878 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226878&action=review

> Source/WebCore/platform/graphics/MediaPlayer.h:251
> +    virtual bool doesHaveAttribute(const QualifiedName&) const { return false; }

This is a layering violation, QualifiedName is in WebCore/dom.

> Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:39
> +#include "HTMLNames.h"

This can't be included from platform/

> Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:1339
> +        bool value = true;

Nit: why not reuse inheritURI?

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:43
> +#import "HTMLNames.h"

Layering.
Comment 11 Brent Fulgham 2014-03-17 10:18:34 PDT
Created attachment 226935 [details]
Patch
Comment 12 Brent Fulgham 2014-03-17 10:20:38 PDT
Comment on attachment 226935 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226935&action=review

WIP patch to move changes from Mac to Windows.

> Source/WebCore/platform/graphics/MediaPlayer.h:142
> +class QualifiedName;

Whoops -- need to remove this.

> Source/WebKit/win/WebView.cpp:5054
> +    hr = prefsPrivate->isInheritURIQueryComponentEnabled(&enabled); // OOPS! Don't checkin

Oops 2.
Comment 13 Eric Carlson 2014-03-17 10:44:03 PDT
Comment on attachment 226935 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226935&action=review

> Source/WebCore/html/HTMLMediaElement.cpp:5989
> +    

Nit: unnecessary white space.

> Source/WebCore/platform/graphics/MediaPlayer.cpp:1414
> +    

Ditto.

> Source/WebCore/platform/graphics/MediaPlayer.h:303
> +    

Ditto.

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:615
> +    

Ditto.

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:618
> +    

Ditto.

> Source/WebKit2/Shared/WebPreferencesStore.h:218
> +    

Ditto.

> Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h:324
> +    

Ditto.

> Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h:328
> +    

Ditto.

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:2628
> +    

Ditto.

> Source/WebKit/mac/WebView/WebView.mm:2394
> +    

Ditto.
Comment 14 Brent Fulgham 2014-03-17 12:19:17 PDT
Created attachment 226945 [details]
Finalized after testing.
Comment 15 Brent Fulgham 2014-03-17 13:16:53 PDT
Comment on attachment 226935 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226935&action=review

>> Source/WebCore/html/HTMLMediaElement.cpp:5989
>> +    
> 
> Nit: unnecessary white space.

Looks like I have a bad Xcode editor preference set. I'll fix these when landing.
Comment 16 Brent Fulgham 2014-03-17 13:33:50 PDT
Committed r165753: <http://trac.webkit.org/changeset/165753>