Changeset 65779 in webkit


Ignore:
Timestamp:
Aug 21, 2010 11:40:01 AM (14 years ago)
Author:
eric.carlson@apple.com
Message:

2010-08-21 Eric Carlson <eric.carlson@apple.com>

Reviewed by Dan Bernstein.

Media engine should not be asked to open all urls
https://bugs.webkit.org/show_bug.cgi?id=44370

  • platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::load): Do nothing with urls with a type attribute that would be rejected by canPlayType().

2010-08-21 Eric Carlson <eric.carlson@apple.com>

Reviewed by Dan Bernstein.

Media engine should not be asked to open all urls
https://bugs.webkit.org/show_bug.cgi?id=44370

  • media/video-source-none-supported-expected.txt:
  • media/video-source-none-supported.html:
  • media/video-source-type.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65778 r65779  
     12010-08-21  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Media engine should not be asked to open all urls
     6        https://bugs.webkit.org/show_bug.cgi?id=44370
     7
     8        * media/video-source-none-supported-expected.txt:
     9        * media/video-source-none-supported.html:
     10        * media/video-source-type.html:
     11
    1122010-08-21  Ademar de Souza Reis Jr  <ademar.reis@openbossa.org>
    213
  • trunk/LayoutTests/media/video-source-none-supported-expected.txt

    r63684 r65779  
    111. Test that no usable <source> element leaves the media element with networkState == NETWORK_NO_SOURCE
    22
    3 EVENT(error)
     3++ ERROR, src = test.mp4, type = "audio/x-chicken-face"
    44EXPECTED (event.target.tagName == 'SOURCE') OK
    5 EXPECTED (video.networkState == '3') OK
     5EXPECTED (event.target.parentNode.networkState > '1') OK
     6
     7++ ERROR, src = test.ogv, type = "video/x-higglety-pigglety"
     8EXPECTED (event.target.tagName == 'SOURCE') OK
     9EXPECTED (event.target.parentNode.networkState > '1') OK
     10
     11++ ERROR, src = doesnotexist.mp4, type = ""
     12EXPECTED (event.target.tagName == 'SOURCE') OK
     13EXPECTED (event.target.parentNode.networkState == '3') OK
     14
    615END OF TEST
    716
  • trunk/LayoutTests/media/video-source-none-supported.html

    r53478 r65779  
    55    <script src=video-test.js></script>
    66    <script>
     7
    78        function setup()
    89        {
     10            findMediaElement();
    911            document.addEventListener("error", errorEvent, true);
    1012        }
     
    1214        function errorEvent(evt)
    1315        {
    14             consoleWrite("EVENT(error)");
     16            consoleWrite("++ ERROR, src = " + relativeURL(event.target.src) + ", type = \"" + event.target.type + "\"");
     17            testExpected("event.target.tagName", "SOURCE", "==");
     18           
     19            // Any more source elements pending?
     20            var nextSource = event.target.nextSibling;
     21            while (video.hasChildNodes()) {
     22                if (!nextSource || nextSource.tagName == "SOURCE")
     23                    break;
     24                nextSource = nextSource.nextSibling;
     25            }
    1526
    16             testExpected("event.target.tagName", "SOURCE", "==");
     27            if (!nextSource) {
     28                testExpected("event.target.parentNode.networkState", HTMLMediaElement.NETWORK_NO_SOURCE, "==");
     29                consoleWrite("");
     30                endTest();
     31            } else {
     32                // Because the error event is fired asynchronously the network state can be either
     33                // NETWORK_LOADING or NETWORK_NO_SOURCE, depending on whether or not
     34                testExpected("event.target.parentNode.networkState", HTMLMediaElement.NETWORK_IDLE, ">");
     35            }
    1736
    18             findMediaElement();
    19             testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_NO_SOURCE, "==");
    20             endTest();
     37            consoleWrite("");
    2138        }
     39    </script>
    2240
    23     </script>
    2441</head>
    2542<body>
    26     <video controls><source src="doesnotexist.mp4"></video>
     43    <video controls>
     44        <source src="test.mp4" type="audio/x-chicken-face">
     45        <source src="test.ogv" type="video/x-higglety-pigglety">
     46        <source src="doesnotexist.mp4">
     47    </video>
    2748
    2849    <p>1. Test that no usable &lt;source&gt; element leaves the media element with
  • trunk/LayoutTests/media/video-source-type.html

    r48539 r65779  
     1<!DOCTYPE html>
     2<html>
     3<head>
     4    <title> &lt;source&gt; @type attribute</title>
     5
     6    <script src=media-file.js></script>
     7    <script src=video-test.js></script>
     8    <script>
     9        function setup()
     10        {
     11            video = mediaElement = document.getElementsByTagName('video')[0];
     12       
     13            waitForEvent("loadstart", function () {
     14                testExpected("relativeURL(video.currentSrc) ", findMediaFile("video", "content/test"));
     15                endTest();
     16            });
     17        }
     18    </script>
     19</head>
    120<body>
    2 <script src=media-file.js></script>
    3 <script src=video-test.js></script>
    4 <video controls>
    5     <source src=content/error.mpeg type=video/blahblah>
    6     <source src=content/test.mp4 type=video/mpeg>
    7     <source src=content/test.ogv type=video/ogg>
    8     <source src=content/error2.mpeg type=video/mpeg>
    9 </video>
    10 <script>
    11     video = mediaElement = document.getElementsByTagName('video')[0];
    12 
    13     waitForEvent("loadstart", function () {
    14         testExpected("relativeURL(video.currentSrc) ", findMediaFile("video", "content/test"));
    15         endTest();
    16     });
    17 </script>
     21    <video controls>
     22        <source src=content/error.mpeg type=video/blahblah>
     23        <source src=test.mp4 type=video/x-chicken-face>
     24        <source src=test.ogv type=audio/x-higglety-pigglety>
     25        <source src=content/test.mp4 type=video/mpeg>
     26        <source src=content/test.ogv type=video/ogg>
     27        <source src=content/error2.mpeg type=video/mpeg>
     28    </video>
     29    <script>setup();</script>
     30</body>
     31</html>
  • trunk/WebCore/ChangeLog

    r65776 r65779  
     12010-08-21  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Media engine should not be asked to open all urls
     6        https://bugs.webkit.org/show_bug.cgi?id=44370
     7
     8        * platform/graphics/MediaPlayer.cpp:
     9        (WebCore::MediaPlayer::load): Do nothing with urls with a type attribute that would be
     10        rejected by canPlayType().
     11
    1122010-08-21  Ariya Hidayat  <ariya@sencha.com>
    213
  • trunk/WebCore/platform/graphics/MediaPlayer.cpp

    r65758 r65779  
    292292        engine = chooseBestEngineForTypeAndCodecs(type, typeCodecs);
    293293
    294     // if we didn't find an engine that claims the MIME type, just use the first engine
    295     if (!engine && !installedMediaEngines().isEmpty())
     294    // If we didn't find an engine and no MIME type is specified, just use the first engine.
     295    if (!engine && type.isEmpty() && !installedMediaEngines().isEmpty())
    296296        engine = installedMediaEngines()[0];
    297297   
    298     // don't delete and recreate the player unless it comes from a different engine
    299     if (engine && m_currentMediaEngine != engine) {
     298    // Don't delete and recreate the player unless it comes from a different engine
     299    if (!engine) {
     300        m_currentMediaEngine = engine;
     301        m_private.clear();
     302    } else if (m_currentMediaEngine != engine) {
    300303        m_currentMediaEngine = engine;
    301304        m_private.clear();
Note: See TracChangeset for help on using the changeset viewer.