Changeset 261922 in webkit


Ignore:
Timestamp:
May 20, 2020 8:52:36 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

[GStreamer] <img> tag needs to support video formats
https://bugs.webkit.org/show_bug.cgi?id=180370

Patch by Philippe Normand <pnormand@igalia.com> on 2020-05-20
Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

GStreamer implementation of the ImageDecoder. It currently doesn't support zero-copy
rendering though due to the the NativeImagePtr requirement.

  • platform/GStreamer.cmake:
  • platform/MIMETypeRegistry.cpp:

(WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):

  • platform/graphics/ImageDecoder.cpp:

(WebCore::ImageDecoder::create):
(WebCore::ImageDecoder::supportsMediaType):

  • platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: Added.

(WebCore::toSample):
(WebCore::ImageDecoderGStreamer::create):
(WebCore::ImageDecoderGStreamer::ImageDecoderGStreamer):
(WebCore::ImageDecoderGStreamer::supportsContainerType):
(WebCore::ImageDecoderGStreamer::canDecodeType):
(WebCore::ImageDecoderGStreamer::encodedDataStatus const):
(WebCore::ImageDecoderGStreamer::size const):
(WebCore::ImageDecoderGStreamer::repetitionCount const):
(WebCore::ImageDecoderGStreamer::uti const):
(WebCore::ImageDecoderGStreamer::frameOrientationAtIndex const):
(WebCore::ImageDecoderGStreamer::frameDurationAtIndex const):
(WebCore::ImageDecoderGStreamer::frameHasAlphaAtIndex const):
(WebCore::ImageDecoderGStreamer::frameBytesAtIndex const):
(WebCore::ImageDecoderGStreamer::createFrameImageAtIndex):
(WebCore::ImageDecoderGStreamer::setData):
(WebCore::ImageDecoderGStreamer::clearFrameBufferCache):
(WebCore::ImageDecoderGStreamer::sampleAtIndex const):
(WebCore::ImageDecoderGStreamer::InnerDecoder::decodebinPadAddedCallback):
(WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad):
(WebCore::ImageDecoderGStreamer::handleSample):
(WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage):
(WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
(WebCore::ImageDecoderGStreamer::InnerDecoder::run):
(WebCore::ImageDecoderGStreamer::InnerDecoder::encodedDataStatus const):
(WebCore::ImageDecoderGStreamer::pushEncodedData):

  • platform/graphics/gstreamer/ImageDecoderGStreamer.h: Added.
  • platform/graphics/gstreamer/ImageGStreamer.h:

(WebCore::ImageGStreamer::createImage):
(WebCore::ImageGStreamer::image):
(WebCore::ImageGStreamer::setCropRect):
(WebCore::ImageGStreamer::rect):
(WebCore::ImageGStreamer::hasAlpha const):

  • platform/graphics/gstreamer/ImageGStreamerCairo.cpp:

(WebCore::ImageGStreamer::ImageGStreamer):

  • platform/graphics/gstreamer/MediaSampleGStreamer.h:

LayoutTests:

Update TestExpectations for tests using videos for the <img> tag.

  • http/conf/flatpak-httpd.conf:
  • platform/glib/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/wpe/TestExpectations:
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r261919 r261922  
     12020-05-20  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] <img> tag needs to support video formats
     4        https://bugs.webkit.org/show_bug.cgi?id=180370
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Update TestExpectations for tests using videos for the <img> tag.
     9       
     10        * http/conf/flatpak-httpd.conf:
     11        * platform/glib/TestExpectations:
     12        * platform/gtk/TestExpectations:
     13        * platform/wpe/TestExpectations:
     14
    1152020-05-20  Alan Kinsley  <zalan@apple.com>
    216
  • trunk/LayoutTests/http/conf/flatpak-httpd.conf

    r259341 r261922  
    5252UseCanonicalName On
    5353HostnameLookups Off
    54 
    55 TypesConfig /usr/conf/mime.types
    5654
    5755LogLevel warn
  • trunk/LayoutTests/platform/glib/TestExpectations

    r261902 r261922  
    7474# 2. EXPECTED FAILURES
    7575#////////////////////////////////////////////////////////////////////////////////////////
     76
     77webkit.org/b/211995 fast/images/animated-image-mp4.html [ Failure ]
    7678
    7779#////////////////////////////////////////////////////////////////////////////////////////
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r261902 r261922  
    10691069webkit.org/b/175419 imported/w3c/web-platform-tests/fetch/api/abort/serviceworker-intercepted.https.html [ Failure Pass ]
    10701070
    1071 # Loading MP4 as an image is not supported by GTK
    1072 webkit.org/b/180370 fast/images/animated-image-mp4.html [ Skip ]
    1073 webkit.org/b/180370 http/tests/images/image-supports-video.html [ Skip ]
    1074 webkit.org/b/180370 fast/images/animated-image-mp4-crash.html [ Skip ]
    1075 
    10761071# GTK ought to support async clipboard
    10771072webkit.org/b/211979 editing/async-clipboard/clipboard-change-data-while-writing.html [ Failure ]
  • trunk/LayoutTests/platform/wpe/TestExpectations

    r261913 r261922  
    369369
    370370Bug(WPE) fast/hidpi/pdf-image-scaled.html [ Skip ]
    371 
    372 # Loading MP4 as an image is not supported
    373 webkit.org/b/180370 fast/images/animated-image-mp4.html [ Skip ]
    374 webkit.org/b/180370 fast/images/animated-image-mp4-crash.html [ Skip ]
    375 webkit.org/b/180370 http/tests/images/image-supports-video.html [ Skip ]
    376371
    377372# Only Mac has implemented DictionaryLookup
  • trunk/Source/WebCore/ChangeLog

    r261921 r261922  
     12020-05-20  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] <img> tag needs to support video formats
     4        https://bugs.webkit.org/show_bug.cgi?id=180370
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        GStreamer implementation of the ImageDecoder. It currently doesn't support zero-copy
     9        rendering though due to the the NativeImagePtr requirement.
     10
     11        * platform/GStreamer.cmake:
     12        * platform/MIMETypeRegistry.cpp:
     13        (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
     14        * platform/graphics/ImageDecoder.cpp:
     15        (WebCore::ImageDecoder::create):
     16        (WebCore::ImageDecoder::supportsMediaType):
     17        * platform/graphics/gstreamer/ImageDecoderGStreamer.cpp: Added.
     18        (WebCore::toSample):
     19        (WebCore::ImageDecoderGStreamer::create):
     20        (WebCore::ImageDecoderGStreamer::ImageDecoderGStreamer):
     21        (WebCore::ImageDecoderGStreamer::supportsContainerType):
     22        (WebCore::ImageDecoderGStreamer::canDecodeType):
     23        (WebCore::ImageDecoderGStreamer::encodedDataStatus const):
     24        (WebCore::ImageDecoderGStreamer::size const):
     25        (WebCore::ImageDecoderGStreamer::repetitionCount const):
     26        (WebCore::ImageDecoderGStreamer::uti const):
     27        (WebCore::ImageDecoderGStreamer::frameOrientationAtIndex const):
     28        (WebCore::ImageDecoderGStreamer::frameDurationAtIndex const):
     29        (WebCore::ImageDecoderGStreamer::frameHasAlphaAtIndex const):
     30        (WebCore::ImageDecoderGStreamer::frameBytesAtIndex const):
     31        (WebCore::ImageDecoderGStreamer::createFrameImageAtIndex):
     32        (WebCore::ImageDecoderGStreamer::setData):
     33        (WebCore::ImageDecoderGStreamer::clearFrameBufferCache):
     34        (WebCore::ImageDecoderGStreamer::sampleAtIndex const):
     35        (WebCore::ImageDecoderGStreamer::InnerDecoder::decodebinPadAddedCallback):
     36        (WebCore::ImageDecoderGStreamer::InnerDecoder::connectDecoderPad):
     37        (WebCore::ImageDecoderGStreamer::handleSample):
     38        (WebCore::ImageDecoderGStreamer::InnerDecoder::handleMessage):
     39        (WebCore::ImageDecoderGStreamer::InnerDecoder::preparePipeline):
     40        (WebCore::ImageDecoderGStreamer::InnerDecoder::run):
     41        (WebCore::ImageDecoderGStreamer::InnerDecoder::encodedDataStatus const):
     42        (WebCore::ImageDecoderGStreamer::pushEncodedData):
     43        * platform/graphics/gstreamer/ImageDecoderGStreamer.h: Added.
     44        * platform/graphics/gstreamer/ImageGStreamer.h:
     45        (WebCore::ImageGStreamer::createImage):
     46        (WebCore::ImageGStreamer::image):
     47        (WebCore::ImageGStreamer::setCropRect):
     48        (WebCore::ImageGStreamer::rect):
     49        (WebCore::ImageGStreamer::hasAlpha const):
     50        * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
     51        (WebCore::ImageGStreamer::ImageGStreamer):
     52        * platform/graphics/gstreamer/MediaSampleGStreamer.h:
     53
    1542020-05-20  Andy Estes  <aestes@apple.com>
    255
  • trunk/Source/WebCore/platform/GStreamer.cmake

    r260987 r261922  
    1414        platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
    1515        platform/graphics/gstreamer/GStreamerVideoFrameHolder.cpp
     16        platform/graphics/gstreamer/ImageDecoderGStreamer.cpp
    1617        platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp
    1718        platform/graphics/gstreamer/MediaEngineConfigurationFactoryGStreamer.cpp
  • trunk/Source/WebCore/platform/MIMETypeRegistry.cpp

    r261479 r261922  
    5959#endif
    6060
     61#if USE(GSTREAMER)
     62#include "ImageDecoderGStreamer.h"
     63#endif
     64
    6165namespace WebCore {
    6266
     
    434438#if HAVE(AVASSETREADER)
    435439    if (ImageDecoderAVFObjC::supportsContainerType(mimeType))
     440        return true;
     441#endif
     442
     443#if USE(GSTREAMER)
     444    if (ImageDecoderGStreamer::supportsContainerType(mimeType))
    436445        return true;
    437446#endif
  • trunk/Source/WebCore/platform/graphics/ImageDecoder.cpp

    r232136 r261922  
    3939#endif
    4040
     41#if USE(GSTREAMER)
     42#include "ImageDecoderGStreamer.h"
     43#endif
     44
    4145namespace WebCore {
    4246
     
    4852    if (!ImageDecoderCG::canDecodeType(mimeType) && ImageDecoderAVFObjC::canDecodeType(mimeType))
    4953        return ImageDecoderAVFObjC::create(data, mimeType, alphaOption, gammaAndColorProfileOption);
     54#endif
     55
     56#if USE(GSTREAMER)
     57    if (ImageDecoderGStreamer::canDecodeType(mimeType))
     58        return ImageDecoderGStreamer::create(data, mimeType, alphaOption, gammaAndColorProfileOption);
    5059#endif
    5160
     
    7786#endif
    7887
     88#if USE(GSTREAMER)
     89    if (ImageDecoderGStreamer::supportsMediaType(type))
     90        return true;
     91#endif
     92
    7993    return false;
    8094}
  • trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h

    r235171 r261922  
    1818 */
    1919
    20 #ifndef ImageGStreamer_h
    21 #define ImageGStreamer_h
     20#pragma once
    2221
    2322#if ENABLE(VIDEO) && USE(GSTREAMER)
     
    3837
    3938class ImageGStreamer : public RefCounted<ImageGStreamer> {
    40     public:
    41         static RefPtr<ImageGStreamer> createImage(GstSample* sample)
    42         {
    43             auto image = adoptRef(new ImageGStreamer(sample));
    44             if (!image->m_image)
    45                 return nullptr;
     39public:
     40    static RefPtr<ImageGStreamer> createImage(GstSample* sample)
     41    {
     42        auto image = adoptRef(new ImageGStreamer(sample));
     43        if (!image->m_image)
     44            return nullptr;
    4645
    47             return image;
    48         }
    49         ~ImageGStreamer();
     46        return image;
     47    }
     48    ~ImageGStreamer();
    5049
    51         BitmapImage& image()
    52         {
    53             ASSERT(m_image);
    54             return *m_image.get();
    55         }
     50    BitmapImage& image()
     51    {
     52        ASSERT(m_image);
     53        return *m_image.get();
     54    }
    5655
    57         void setCropRect(FloatRect rect) { m_cropRect = rect; }
    58         FloatRect rect()
    59         {
    60             ASSERT(m_image);
    61             if (!m_cropRect.isEmpty())
    62                 return FloatRect(m_cropRect);
    63             return FloatRect(0, 0, m_image->size().width(), m_image->size().height());
    64         }
     56    void setCropRect(FloatRect rect) { m_cropRect = rect; }
     57    FloatRect rect()
     58    {
     59        ASSERT(m_image);
     60        if (!m_cropRect.isEmpty())
     61            return FloatRect(m_cropRect);
     62        return FloatRect(0, 0, m_image->size().width(), m_image->size().height());
     63    }
    6564
    66     private:
    67         ImageGStreamer(GstSample*);
    68         RefPtr<BitmapImage> m_image;
    69         FloatRect m_cropRect;
     65    bool hasAlpha() const { return m_hasAlpha; }
     66
     67private:
     68    ImageGStreamer(GstSample*);
     69    RefPtr<BitmapImage> m_image;
     70    FloatRect m_cropRect;
    7071#if USE(CAIRO)
    71         GstVideoFrame m_videoFrame;
    72         bool m_frameMapped { false };
     72    GstVideoFrame m_videoFrame;
     73    bool m_frameMapped { false };
    7374#endif
    74     };
     75    bool m_hasAlpha { false };
     76};
     77
    7578}
    76 
    77 #endif // USE(GSTREAMER)
    78 #endif
     79#endif // ENABLE(VIDEO) && USE(GSTREAMER)
  • trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp

    r248464 r261922  
    4242    // Right now the TextureMapper only supports chromas with one plane
    4343    ASSERT(GST_VIDEO_INFO_N_PLANES(&videoInfo) == 1);
     44
     45    m_hasAlpha = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo);
    4446
    4547    GstBuffer* buffer = gst_sample_get_buffer(sample);
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaSampleGStreamer.h

    r258844 r261922  
    3030namespace WebCore {
    3131
    32 class MediaSampleGStreamer final : public MediaSample {
     32class MediaSampleGStreamer : public MediaSample {
    3333public:
    3434    static Ref<MediaSampleGStreamer> create(GRefPtr<GstSample>&& sample, const FloatSize& presentationSize, const AtomString& trackId)
     
    5656    void dump(PrintStream&) const override;
    5757
     58protected:
     59    MediaSampleGStreamer(GRefPtr<GstSample>&&, const FloatSize& presentationSize, const AtomString& trackId);
     60    virtual ~MediaSampleGStreamer() = default;
     61
    5862private:
    59     MediaSampleGStreamer(GRefPtr<GstSample>&&, const FloatSize& presentationSize, const AtomString& trackId);
    6063    MediaSampleGStreamer(const FloatSize& presentationSize, const AtomString& trackId);
    61     virtual ~MediaSampleGStreamer() = default;
    6264
    6365    MediaTime m_pts;
Note: See TracChangeset for help on using the changeset viewer.