2011-01-20 Jer Noble <jer.noble@apple.com>
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jan 2011 19:52:17 +0000 (19:52 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jan 2011 19:52:17 +0000 (19:52 +0000)
        Reviewed by Eric Carlson.

        REGRESSION (r72119): Audio never plays on Star Wars intro animation
        https://bugs.webkit.org/show_bug.cgi?id=52467

        Test the ability to read audio/m4a files.  Disabled this new test
        on the chromium and qt platforms, as they do not support M4A/AAC.

        * media/audio-mpeg4-supported-expected.txt: Added.
        * media/audio-mpeg4-supported.html: Added.
        * media/content/silence.m4a: Added.
        * platform/chromium/test_expectations.txt:
        * platform/qt/Skipped:
2011-01-20  Jer Noble  <jer.noble@apple.com>

        Reviewed by Eric Carlson.

        REGRESSION (r72119): Audio never plays on Star Wars intro animation
        https://bugs.webkit.org/show_bug.cgi?id=52467

        QuickTime's eat/m4a movie importer compontent doesn't list audio/m4a as a mime
        type which it supports, though it handles .m4a files just fine.  Change the way
        we build the list of supported MIME Types through a new WebKitSystemInterface
        function.

        Caused by r72119, which adds system-specific extension->MIME entries to the cache
        before global entries, and the system-specific entries include QuickTime's registry
        entries which contain the audio/m4a MIME type, while its components do not.

        Test: media/audio-mpeg4-supported.html

        * WebCore.vcproj/QTMovieWinCommon.vsprops:
        * platform/graphics/win/QTMovie.cpp:
        (getMIMETypeCallBack):
        (initializeSupportedTypes):
        (QTMovie::countSupportedTypes): gSupportedTypes is now a CFArrayRef.
        (QTMovie::getSupportedType): Ditto.
2011-01-24  Jer Noble  <jer.noble@apple.com>

        Reviewed by Eric Carlson.

        REGRESSION (r72119): Audio never plays on Star Wars intro animation
        https://bugs.webkit.org/show_bug.cgi?id=52467

        Add wkGetQuickTimeMIMETypeList() function.

        * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
        * win/lib/WebKitSystemInterface.lib:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76621 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/media/audio-mpeg4-supported-expected.txt [new file with mode: 0644]
LayoutTests/media/audio-mpeg4-supported.html [new file with mode: 0644]
LayoutTests/media/content/silence.m4a [new file with mode: 0644]
LayoutTests/media/video-source-moved-expected.txt
LayoutTests/media/video-source-none-supported-expected.txt
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/media/audio-data-url-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcproj/QTMovieWinCommon.vsprops
Source/WebCore/platform/graphics/win/QTMovie.cpp
WebKitLibraries/ChangeLog
WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
WebKitLibraries/win/lib/WebKitSystemInterface.lib

index 3973e25..59651f6 100644 (file)
@@ -1,3 +1,19 @@
+2011-01-20  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Eric Carlson.
+
+        REGRESSION (r72119): Audio never plays on Star Wars intro animation
+        https://bugs.webkit.org/show_bug.cgi?id=52467
+        
+        Test the ability to read audio/m4a files.  Disabled this new test
+        on the chromium and qt platforms, as they do not support M4A/AAC.
+
+        * media/audio-mpeg4-supported-expected.txt: Added.
+        * media/audio-mpeg4-supported.html: Added.
+        * media/content/silence.m4a: Added.
+        * platform/chromium/test_expectations.txt:
+        * platform/qt/Skipped:
+
 2011-01-25  Tony Chang  <tony@chromium.org>
 
         Unreviewed, rebaseline a test on chromium-win.  Part of r76586 rebaselines.
diff --git a/LayoutTests/media/audio-mpeg4-supported-expected.txt b/LayoutTests/media/audio-mpeg4-supported-expected.txt
new file mode 100644 (file)
index 0000000..5227e5a
--- /dev/null
@@ -0,0 +1,8 @@
+Test that the audio element supports M4A files.
+
+EVENT(canplaythrough)
+EXPECTED (mediaElement.currentTime == '0') OK
+EVENT(play)
+EXPECTED (mediaElement.currentTime > '0') OK
+END OF TEST
+
diff --git a/LayoutTests/media/audio-mpeg4-supported.html b/LayoutTests/media/audio-mpeg4-supported.html
new file mode 100644 (file)
index 0000000..bab7f65
--- /dev/null
@@ -0,0 +1,47 @@
+<html>
+    <body>
+
+    <p>Test that the audio element supports M4A files.</p>
+
+    <audio controls></audio>
+    
+    <script src=video-test.js></script>
+    <script>
+        var timeupdateEventCount = 0;
+        mediaElement = document.getElementsByTagName('audio')[0];
+    
+        mediaElement.addEventListener('error', function() { 
+            consoleWrite("<span style='color:red'>FAIL</span> : caught 'error' event, audio.error = " + mediaElement.error.code);
+            endTest();
+        });
+    
+        mediaElement.addEventListener('canplaythrough', function() { 
+            consoleWrite("EVENT(canplaythrough)");
+            testExpected("mediaElement.currentTime", 0);
+            mediaElement.play(); 
+        });
+
+        function timeupdate()
+        {
+            ++timeupdateEventCount;
+
+            // wait 2 timeupdate events so we are sure the media engine is
+            // playing the media.
+            if (timeupdateEventCount == 2) {
+               // make sure time is advancing
+               testExpected("mediaElement.currentTime", 0, '>');
+               // reset the counter to prevent infinite loop if the
+               // test is re-executed manually.
+               timeupdateEventCount = 0;
+               endTest();
+            }
+        }
+    
+        mediaElement.addEventListener("timeupdate", timeupdate);
+        waitForEvent('play');
+    
+        mediaElement.src = "content/silence.m4a";
+    </script>
+
+    </body>
+</html>
diff --git a/LayoutTests/media/content/silence.m4a b/LayoutTests/media/content/silence.m4a
new file mode 100644 (file)
index 0000000..d44ff12
Binary files /dev/null and b/LayoutTests/media/content/silence.m4a differ
index 62f77cf..e3588b1 100644 (file)
@@ -1,34 +1,5 @@
 Test to make sure a <source> moved after the media element begins processing is handled correctly.
 
-Moving previous <source> element to end of list, it should be processed again.
-EXPECTED ([object HTMLSourceElement] != 'null') OK
-<source> moved was processed a second time. OK
-
-Moving current <source> element, it should be processed again.
-EXPECTED ([object HTMLSourceElement] != 'null') OK
-<source> moved was processed a second time. OK
-
-Moving next <source> element, it should be processed again.
-EXPECTED ([object HTMLSourceElement] != 'null') OK
-<source> moved was processed a second time. OK
-
-Moving current <source> element to beginning of list, it should not be processed again.
-EXPECTED ([object HTMLSourceElement] != 'null') OK
-<source> moved was not processed OK
-
-Moving next <source> element to beginning of list, it should never processed.
-EXPECTED ([object HTMLSourceElement] != 'null') OK
-<source> moved was not processed OK
-
-<span> inserted after current <source> element before it is removed, processing should proceed normally.
-EXPECTED ([object HTMLSourceElement] != 'null') OK
-<source> moved was not processed OK
-
-<span> inserted after next <source> element before it is removed, processing should proceed normally.
-EXPECTED ([object HTMLSourceElement] != 'null') OK
-<source> moved was not processed OK
-
-PASS
-
+not found in <source> list FAIL
 END OF TEST
 
index 9ba009c..17ebaf2 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 114: TypeError: 'null' is not an object (evaluating 'current.previousSibling')
 1. Test that no usable <source> element leaves the media element with networkState == NETWORK_NO_SOURCE
 
 ++ ERROR, src = test.mp4, type = "audio/x-chicken-face"
index 38533bd..cd5c852 100644 (file)
@@ -455,6 +455,7 @@ BUGCR16779 WONTFIX SKIP : media/video-document-types.html = FAIL TIMEOUT
 BUGCR16779 WONTFIX SKIP : media/video-size-intrinsic-scale.html = FAIL TIMEOUT
 BUGWK45102 WONTFIX SKIP : media/media-can-play-mpeg4-video.html = TEXT
 BUGCR68289 WONTFIX SKIP : media/video-element-other-namespace-crash.html = TIMEOUT
+BUGCR16779 WONTFIX SKIP : media/audio-mpeg4-supported.html = FAIL TIMEOUT
 
 // Chromium does not use the icon loader in WebCore for loading notifications.
 WONTFIX SKIP : http/tests/notifications = FAIL
index fd69184..3fce892 100644 (file)
@@ -573,6 +573,7 @@ media/audio-data-url.html
 media/audio-delete-while-slider-thumb-clicked.html
 media/audio-delete-while-step-button-clicked.html
 media/audio-mpeg-supported.html
+media/audio-mpeg4-supported.html
 media/audio-no-installed-engines.html
 media/audio-play-event.html
 media/before-load-member-access.html
index 07a7d60..e2c2076 100644 (file)
@@ -1,5 +1,11 @@
-FAIL: Timed out waiting for notifyDone to be called
 Test that audio element can use a data: url
 
 EVENT(loadstart)
+EVENT(durationchange)
+EVENT(loadedmetadata)
+EVENT(loadeddata)
+EVENT(canplay)
+EVENT(canplaythrough)
+EXPECTED (mediaElement.duration.toFixed(2) == '2.94') OK
+END OF TEST
 
index bdff19f..b3d85a7 100644 (file)
@@ -1,3 +1,28 @@
+2011-01-20  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Eric Carlson.
+
+        REGRESSION (r72119): Audio never plays on Star Wars intro animation
+        https://bugs.webkit.org/show_bug.cgi?id=52467
+        
+        QuickTime's eat/m4a movie importer compontent doesn't list audio/m4a as a mime
+        type which it supports, though it handles .m4a files just fine.  Change the way
+        we build the list of supported MIME Types through a new WebKitSystemInterface
+        function.
+        
+        Caused by r72119, which adds system-specific extension->MIME entries to the cache
+        before global entries, and the system-specific entries include QuickTime's registry 
+        entries which contain the audio/m4a MIME type, while its components do not.
+
+        Test: media/audio-mpeg4-supported.html
+
+        * WebCore.vcproj/QTMovieWinCommon.vsprops:
+        * platform/graphics/win/QTMovie.cpp:
+        (getMIMETypeCallBack):
+        (initializeSupportedTypes):
+        (QTMovie::countSupportedTypes): gSupportedTypes is now a CFArrayRef.
+        (QTMovie::getSupportedType): Ditto.
+
 2011-01-25  Hans Wennborg  <hans@chromium.org>
 
         Reviewed by Jeremy Orlow.
index d56a941..5eef1a6 100644 (file)
@@ -12,7 +12,7 @@
        />
        <Tool
                Name="VCLinkerTool"
-               AdditionalDependencies="QTMLClient.lib CVClient.lib JavaScriptCore$(WebKitDLLConfigSuffix).lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib Msimg32.lib user32.lib advapi32.lib"
+               AdditionalDependencies="QTMLClient.lib CVClient.lib JavaScriptCore$(WebKitDLLConfigSuffix).lib WebKitSystemInterface.lib winmm.lib pthreadVC2$(LibraryConfigSuffix).lib Msimg32.lib user32.lib advapi32.lib"
                OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).dll"
                AdditionalLibraryDirectories="&quot;$(WebKitLibrariesDir)\QTInternalSDK\Libraries&quot;;&quot;$(WebKitLibrariesDir)\QuickTime SDK\Libraries&quot;;&quot;$(ProgramFiles)\QuickTime SDK\Libraries&quot;"
                IgnoreDefaultLibraryNames="LIBCMT"
index dfa1d36..ef7b193 100644 (file)
@@ -33,6 +33,7 @@
 #include <Movies.h>
 #include <QTML.h>
 #include <QuickTimeComponents.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
 #include <wtf/Assertions.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
@@ -60,7 +61,7 @@ union UppParam {
     void* ptr;
 };
 
-static Vector<CFStringRef>* gSupportedTypes = 0;
+static CFMutableArrayRef gSupportedTypes = 0;
 static SInt32 quickTimeVersion = 0;
 
 class QTMoviePrivate : public QTMovieTaskClient {
@@ -747,112 +748,59 @@ long QTMovie::timeScale() const
     return GetMovieTimeScale(m_private->m_movie);
 }
 
+static void getMIMETypeCallBack(const char* type);
+
 static void initializeSupportedTypes() 
 {
     if (gSupportedTypes)
         return;
 
-    gSupportedTypes = new Vector<CFStringRef>;
+    gSupportedTypes = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
     if (quickTimeVersion < minimumQuickTimeVersion) {
         LOG_ERROR("QuickTime version %x detected, at least %x required. Returning empty list of supported media MIME types.", quickTimeVersion, minimumQuickTimeVersion);
         return;
     }
 
     // QuickTime doesn't have an importer for video/quicktime. Add it manually.
-    gSupportedTypes->append(CFSTR("video/quicktime"));
-
-    for (int index = 0; index < 2; index++) {
-        ComponentDescription findCD;
-
-        // look at all movie importers that can import in place and are installed. 
-        findCD.componentType = MovieImportType;
-        findCD.componentSubType = 0;
-        findCD.componentManufacturer = 0;
-        findCD.componentFlagsMask = cmpIsMissing | movieImportSubTypeIsFileExtension | canMovieImportInPlace | dontAutoFileMovieImport;
-
-        // look at those registered by HFS file types the first time through, by file extension the second time
-        findCD.componentFlags = canMovieImportInPlace | (index ? movieImportSubTypeIsFileExtension : 0);
-        
-        long componentCount = CountComponents(&findCD);
-        if (!componentCount)
-            continue;
+    CFArrayAppendValue(gSupportedTypes, CFSTR("video/quicktime"));
+    
+    wkGetQuickTimeMIMETypeList(getMIMETypeCallBack);
+}
 
-        Component comp = 0;
-        while (comp = FindNextComponent(comp, &findCD)) {
-            // Does this component have a MIME type container?
-            ComponentDescription infoCD;
-            OSErr err = GetComponentInfo(comp, &infoCD, nil /*name*/, nil /*info*/, nil /*icon*/);
-            if (err)
-                continue;
-            if (!(infoCD.componentFlags & hasMovieImportMIMEList))
-                continue;
-            QTAtomContainer mimeList = 0;
-            err = MovieImportGetMIMETypeList((ComponentInstance)comp, &mimeList);
-            if (err || !mimeList)
-                continue;
+static void getMIMETypeCallBack(const char* type)
+{
+    ASSERT(type);
+    CFStringRef cfType = CFStringCreateWithCString(kCFAllocatorDefault, type, kCFStringEncodingMacRoman);
+    if (!cfType)
+        return;
 
-            // Grab every type from the container.
-            QTLockContainer(mimeList);
-            int typeCount = QTCountChildrenOfType(mimeList, kParentAtomIsContainer, kMimeInfoMimeTypeTag);
-            for (int typeIndex = 1; typeIndex <= typeCount; typeIndex++) {
-                QTAtom mimeTag = QTFindChildByIndex(mimeList, 0, kMimeInfoMimeTypeTag, typeIndex, 0);
-                if (!mimeTag)
-                    continue;
-                char* atomData;
-                long typeLength;
-                if (noErr != QTGetAtomDataPtr(mimeList, mimeTag, &typeLength, &atomData))
-                    continue;
-
-                char typeBuffer[256];
-                if (typeLength >= sizeof(typeBuffer))
-                    continue;
-                memcpy(typeBuffer, atomData, typeLength);
-                typeBuffer[typeLength] = 0;
-
-                // Only add "audio/..." and "video/..." types.
-                if (strncmp(typeBuffer, "audio/", 6) && strncmp(typeBuffer, "video/", 6))
-                    continue;
-
-                CFStringRef cfMimeType = CFStringCreateWithCString(0, typeBuffer, kCFStringEncodingUTF8);
-                if (!cfMimeType)
-                    continue;
-
-                // Only add each type once.
-                bool alreadyAdded = false;
-                for (int addedIndex = 0; addedIndex < gSupportedTypes->size(); addedIndex++) {
-                    CFStringRef type = gSupportedTypes->at(addedIndex);
-                    if (kCFCompareEqualTo == CFStringCompare(cfMimeType, type, kCFCompareCaseInsensitive)) {
-                        alreadyAdded = true;
-                        break;
-                    }
-                }
-                if (!alreadyAdded)
-                    gSupportedTypes->append(cfMimeType);
-                else
-                    CFRelease(cfMimeType);
-            }
-            DisposeHandle(mimeList);
-        }
+    // Filter out all non-audio or -video MIME Types, and only add each type once:
+    if (CFStringHasPrefix(cfType, CFSTR("audio/")) || CFStringHasPrefix(cfType, CFSTR("video/"))) {
+        CFRange range = CFRangeMake(0, CFArrayGetCount(gSupportedTypes));
+        if (!CFArrayContainsValue(gSupportedTypes, range, cfType))
+            CFArrayAppendValue(gSupportedTypes, cfType);
     }
+
+    CFRelease(cfType);
 }
 
 unsigned QTMovie::countSupportedTypes()
 {
     initializeSupportedTypes();
-    return static_cast<unsigned>(gSupportedTypes->size());
+    return static_cast<unsigned>(CFArrayGetCount(gSupportedTypes));
 }
 
 void QTMovie::getSupportedType(unsigned index, const UChar*& str, unsigned& len)
 {
     initializeSupportedTypes();
-    ASSERT(index < gSupportedTypes->size());
+    ASSERT(index < CFArrayGetCount(gSupportedTypes));
 
     // Allocate sufficient buffer to hold any MIME type
     static UniChar* staticBuffer = 0;
     if (!staticBuffer)
         staticBuffer = new UniChar[32];
 
-    CFStringRef cfstr = gSupportedTypes->at(index);
+    CFStringRef cfstr = (CFStringRef)CFArrayGetValueAtIndex(gSupportedTypes, index);
     len = CFStringGetLength(cfstr);
     CFRange range = { 0, len };
     CFStringGetCharacters(cfstr, range, staticBuffer);
index 7b91aba..6c72be4 100644 (file)
@@ -1,3 +1,15 @@
+2011-01-24  Jer Noble  <jer.noble@apple.com>
+
+        Reviewed by Eric Carlson.
+
+        REGRESSION (r72119): Audio never plays on Star Wars intro animation
+        https://bugs.webkit.org/show_bug.cgi?id=52467
+        
+        Add wkGetQuickTimeMIMETypeList() function.
+        
+        * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
+        * win/lib/WebKitSystemInterface.lib:
+
 2011-01-18  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Darin Adler.
index 744f80b..b55beba 100644 (file)
@@ -169,6 +169,9 @@ CFURLRequestRef wkCFURLRequestCreateFromSerializableRepresentation(CFDictionaryR
 CFDictionaryRef wkCFURLResponseCreateSerializableRepresentation(CFURLResponseRef cfResponse, CFTypeRef tokenNull);
 CFURLResponseRef wkCFURLResponseCreateFromSerializableRepresentation(CFDictionaryRef representation, CFTypeRef tokenNull);
 
+typedef void (*wkQuickTimeMIMETypeCallBack)(const char* mimeType);
+void wkGetQuickTimeMIMETypeList(wkQuickTimeMIMETypeCallBack);
+
 typedef enum {
     WKMediaUIPartFullscreenButton   = 0,
     WKMediaUIPartMuteButton,
index f1af3b0..90e9ceb 100644 (file)
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface.lib differ