Changeset 65758 in webkit


Ignore:
Timestamp:
Aug 20, 2010 3:19:39 PM (14 years ago)
Author:
eric.carlson@apple.com
Message:

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

Reviewed by Dan Bernstein.

Media element canPlayType("application/octet-stream") not handled correctly
https://bugs.webkit.org/show_bug.cgi?id=44343

Test: media/media-can-play-octet-stream.html

  • platform/graphics/MediaPlayer.cpp: (WebCore::applicationOctetStream): New, accessor for static string used more than once. (WebCore::textPlain): Ditto. (WebCore::codecs): Ditto. (WebCore::chooseBestEngineForTypeAndCodecs): Special case "application/octet-stream". (WebCore::MediaPlayer::load): Use static static string methods. (WebCore::MediaPlayer::supportsType): Special case "application/octet-stream".

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

Reviewed by Dan Bernstein.

Media element canPlayType("application/octet-stream") not handled correctly
https://bugs.webkit.org/show_bug.cgi?id=44343

  • media/media-can-play-octet-stream-expected.txt: Added.
  • media/media-can-play-octet-stream.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65757 r65758  
     12010-08-20  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Media element canPlayType("application/octet-stream") not handled correctly
     6        https://bugs.webkit.org/show_bug.cgi?id=44343
     7
     8        * media/media-can-play-octet-stream-expected.txt: Added.
     9        * media/media-can-play-octet-stream.html: Added.
     10
    1112010-08-20  Ryosuke Niwa  <rniwa@webkit.org>
    212
  • trunk/WebCore/ChangeLog

    r65756 r65758  
     12010-08-20  Eric Carlson  <eric.carlson@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Media element canPlayType("application/octet-stream") not handled correctly
     6        https://bugs.webkit.org/show_bug.cgi?id=44343
     7
     8        Test: media/media-can-play-octet-stream.html
     9
     10        * platform/graphics/MediaPlayer.cpp:
     11        (WebCore::applicationOctetStream): New, accessor for static string used more than once.
     12        (WebCore::textPlain): Ditto.
     13        (WebCore::codecs): Ditto.
     14        (WebCore::chooseBestEngineForTypeAndCodecs): Special case "application/octet-stream".
     15        (WebCore::MediaPlayer::load): Use static static string methods.
     16        (WebCore::MediaPlayer::supportsType): Special case "application/octet-stream".
     17
    1182010-08-20  Adrienne Walker  <enne@google.com>
    219
  • trunk/WebCore/platform/graphics/MediaPlayer.cpp

    r65468 r65758  
    193193}
    194194
     195static const AtomicString& applicationOctetStream()
     196{
     197    DEFINE_STATIC_LOCAL(const AtomicString, applicationOctetStream, ("application/octet-stream"));
     198    return applicationOctetStream;
     199}
     200
     201static const AtomicString& textPlain()
     202{
     203    DEFINE_STATIC_LOCAL(const AtomicString, textPlain, ("text/plain"));
     204    return textPlain;
     205}
     206
     207static const AtomicString& codecs()
     208{
     209    DEFINE_STATIC_LOCAL(const AtomicString, codecs, ("codecs"));
     210    return codecs;
     211}
     212
    195213static MediaPlayerFactory* chooseBestEngineForTypeAndCodecs(const String& type, const String& codecs)
    196214{
     
    200218        return 0;
    201219
     220    // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream"
     221    // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows
     222    // it cannot render.
     223    if (type == applicationOctetStream()) {
     224        if (!codecs.isEmpty())
     225            return 0;
     226    }
     227   
    202228    MediaPlayerFactory* engine = 0;
    203229    MediaPlayer::SupportsType supported = MediaPlayer::IsNotSupported;
     
    249275{
    250276    String type = contentType.type();
    251     String codecs = contentType.parameter("codecs");
    252 
    253     // if we don't know the MIME type, see if the extension can help
    254     if (type.isEmpty() || type == "application/octet-stream" || type == "text/plain") {
     277    String typeCodecs = contentType.parameter(codecs());
     278
     279    // If the MIME type is unhelpful, see if the type registry has a match for the file extension.
     280    if (type.isEmpty() || type == applicationOctetStream() || type == textPlain()) {
    255281        size_t pos = url.reverseFind('.');
    256282        if (pos != notFound) {
     
    264290    MediaPlayerFactory* engine = 0;
    265291    if (!type.isEmpty())
    266         engine = chooseBestEngineForTypeAndCodecs(type, codecs);
     292        engine = chooseBestEngineForTypeAndCodecs(type, typeCodecs);
    267293
    268294    // if we didn't find an engine that claims the MIME type, just use the first engine
     
    529555{
    530556    String type = contentType.type();
    531     String codecs = contentType.parameter("codecs");
    532     MediaPlayerFactory* engine = chooseBestEngineForTypeAndCodecs(type, codecs);
     557    String typeCodecs = contentType.parameter(codecs());
     558
     559    // 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream"
     560    // when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows
     561    // it cannot render.
     562    if (type == applicationOctetStream()) {
     563        if (!typeCodecs.isEmpty())
     564            return IsNotSupported;
     565       
     566        // The MIME type "application/octet-stream" with no parameters is never a type that the user agent knows it
     567        // cannot render.
     568        return MayBeSupported;
     569    }
     570
     571    MediaPlayerFactory* engine = chooseBestEngineForTypeAndCodecs(type, typeCodecs);
    533572
    534573    if (!engine)
    535574        return IsNotSupported;
    536575
    537     return engine->supportsTypeAndCodecs(type, codecs);
     576    return engine->supportsTypeAndCodecs(type, typeCodecs);
    538577}
    539578
Note: See TracChangeset for help on using the changeset viewer.