Changeset 224107 in webkit


Ignore:
Timestamp:
Oct 27, 2017 2:35:53 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

[GStreamer][MSE] Trim space between codecs
https://bugs.webkit.org/show_bug.cgi?id=178160

Patch by Alicia Boya García <aboya@igalia.com> on 2017-10-27
Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

Modify supportsCodecs() to accept a Vector<String> instead of
receiving a string and parsing itself.

This improves passrate for mediasource-is-type-supported as it
ensures that whitespace between codecs is now trimmed and codec
strings such as video/webm;codecs="opus, vp9" are matched as a valid
type, as required by the spec.

This patch also renames supportCodecs() to supportAllCodecs() and adds
a new variant, supportCodec(), that checks for support of an
individual codec.

  • platform/graphics/gstreamer/mse/AppendPipeline.cpp:

(WebCore::AppendPipeline::parseDemuxerSrcPadCaps):

  • platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:

(WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodec):
(WebCore::MediaPlayerPrivateGStreamerMSE::supportsAllCodecs):
(WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):

  • platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:

LayoutTests:

Update expected test output.

  • platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported-expected.txt:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r224091 r224107  
     12017-10-27  Alicia Boya García  <aboya@igalia.com>
     2
     3        [GStreamer][MSE] Trim space between codecs
     4        https://bugs.webkit.org/show_bug.cgi?id=178160
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Update expected test output.
     9
     10        * platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported-expected.txt:
     11
    1122017-10-27  Ryosuke Niwa  <rniwa@webkit.org>
    213
  • trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported-expected.txt

    r223477 r224107  
    88PASS Test invalid MIME format "video/webm;codecs=""
    99FAIL Test invalid MIME format "video/webm;codecs=""" assert_equals: supported expected false but got true
    10 FAIL Test invalid MIME format "video/webm;codecs=","" assert_equals: supported expected false but got true
     10PASS Test invalid MIME format "video/webm;codecs=",""
    1111PASS Test invalid MIME format ""
    1212PASS Test invalid MIME format "null"
     
    2828PASS Test valid WebM type "video/webm;codecs="vorbis""
    2929PASS Test valid WebM type "video/webm;codecs="vp8,vorbis""
    30 FAIL Test valid WebM type "video/webm;codecs="vorbis, vp8"" assert_equals: supported expected true but got false
     30PASS Test valid WebM type "video/webm;codecs="vorbis, vp8""
    3131PASS Test valid WebM type "audio/webm;codecs="vorbis""
    3232PASS Test valid WebM type "AUDIO/WEBM;CODECS="vorbis""
     
    3838PASS Test valid MP4 type "video/mp4;codecs="mp4a.40.2""
    3939PASS Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.2""
    40 FAIL Test valid MP4 type "video/mp4;codecs="mp4a.40.2 , avc1.4d001e "" assert_equals: supported expected true but got false
     40PASS Test valid MP4 type "video/mp4;codecs="mp4a.40.2 , avc1.4d001e ""
    4141PASS Test valid MP4 type "video/mp4;codecs="avc1.4d001e,mp4a.40.5""
    4242
  • trunk/Source/WebCore/ChangeLog

    r224087 r224107  
     12017-10-27  Alicia Boya García  <aboya@igalia.com>
     2
     3        [GStreamer][MSE] Trim space between codecs
     4        https://bugs.webkit.org/show_bug.cgi?id=178160
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Modify supportsCodecs() to accept a Vector<String> instead of
     9        receiving a string and parsing itself.
     10
     11        This improves passrate for `mediasource-is-type-supported` as it
     12        ensures that whitespace between codecs is now trimmed and codec
     13        strings such as `video/webm;codecs="opus, vp9"` are matched as a valid
     14        type, as required by the spec.
     15
     16        This patch also renames supportCodecs() to supportAllCodecs() and adds
     17        a new variant, supportCodec(), that checks for support of an
     18        individual codec.
     19
     20        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
     21        (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
     22        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
     23        (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodec):
     24        (WebCore::MediaPlayerPrivateGStreamerMSE::supportsAllCodecs):
     25        (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
     26        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
     27
    1282017-10-27  Michael Catanzaro  <mcatanzaro@igalia.com>
    229
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp

    r224012 r224107  
    600600        const gchar* originalMediaType = gst_structure_get_string(structure, "original-media-type");
    601601
    602         if (!MediaPlayerPrivateGStreamerMSE::supportsCodecs(originalMediaType)) {
     602        if (!MediaPlayerPrivateGStreamerMSE::supportsCodec(originalMediaType)) {
    603603            m_presentationSize = WebCore::FloatSize();
    604604            m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Invalid;
     
    633633        GstVideoInfo info;
    634634
    635         if (!MediaPlayerPrivateGStreamerMSE::supportsCodecs(structureName)) {
     635        if (!MediaPlayerPrivateGStreamerMSE::supportsCodec(structureName)) {
    636636            m_presentationSize = WebCore::FloatSize();
    637637            m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Invalid;
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp

    r222707 r224107  
    838838}
    839839
    840 bool MediaPlayerPrivateGStreamerMSE::supportsCodecs(const String& codecs)
    841 {
    842     Vector<String> codecEntries;
    843     codecs.split(',', false, codecEntries);
    844 
    845     for (String codec : codecEntries) {
    846         bool isCodecSupported = false;
    847 
    848         // If the codec is named like a mimetype (eg: video/avc) remove the "video/" part.
    849         size_t slashIndex = codec.find('/');
    850         if (slashIndex != WTF::notFound)
    851             codec = codec.substring(slashIndex+1);
    852 
    853         const char* codecData = codec.utf8().data();
    854         for (const auto& pattern : codecSet()) {
    855             isCodecSupported = !fnmatch(pattern.string().utf8().data(), codecData, 0);
    856             if (isCodecSupported)
    857                 break;
    858         }
    859         if (!isCodecSupported)
     840bool MediaPlayerPrivateGStreamerMSE::supportsCodec(String codec)
     841{
     842    // If the codec is named like a mimetype (eg: video/avc) remove the "video/" part.
     843    size_t slashIndex = codec.find('/');
     844    if (slashIndex != WTF::notFound)
     845        codec = codec.substring(slashIndex+1);
     846
     847    for (const auto& pattern : codecSet()) {
     848        bool codecMatchesPattern = !fnmatch(pattern.string().utf8().data(), codec.utf8().data(), 0);
     849        if (codecMatchesPattern)
     850            return true;
     851    }
     852
     853    return false;
     854}
     855
     856bool MediaPlayerPrivateGStreamerMSE::supportsAllCodecs(const Vector<String>& codecs)
     857{
     858    for (String codec : codecs) {
     859        if (!supportsCodec(codec))
    860860            return false;
    861861    }
     
    880880    // Spec says we should not return "probably" if the codecs string is empty.
    881881    if (mimeTypeCache().contains(containerType)) {
    882         String codecs = parameters.type.parameter(ContentType::codecsParameter());
     882        Vector<String> codecs = parameters.type.codecs();
    883883        if (codecs.isEmpty())
    884884            result = MediaPlayer::MayBeSupported;
    885885        else
    886             result = supportsCodecs(codecs) ? MediaPlayer::IsSupported : MediaPlayer::IsNotSupported;
     886            result = supportsAllCodecs(codecs) ? MediaPlayer::IsSupported : MediaPlayer::IsNotSupported;
    887887    }
    888888
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h

    r222649 r224107  
    8484    void notifySeekNeedsDataForTime(const MediaTime&);
    8585
    86     static bool supportsCodecs(const String& codecs);
     86    static bool supportsCodec(String codec);
     87    static bool supportsAllCodecs(const Vector<String>& codecs);
    8788
    8889#if ENABLE(ENCRYPTED_MEDIA)
Note: See TracChangeset for help on using the changeset viewer.