Changeset 209797 in webkit


Ignore:
Timestamp:
Dec 14, 2016 3:16:23 AM (7 years ago)
Author:
eocanha@igalia.com
Message:

REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
https://bugs.webkit.org/show_bug.cgi?id=164022

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

Covered by existing tests.

  • page/Settings.cpp:

Added new setting to disable GStreamer players, so the selection of
MockMediaPlayerMediaSource can be forced for some tests, just like
it's already being done for the AVFoundation player in Mac.
(WebCore::Settings::setGStreamerEnabled):

  • page/Settings.h:

(WebCore::Settings::isGStreamerEnabled):

  • platform/graphics/MediaPlayer.cpp:

(WebCore::buildMediaEnginesVector):
Don't register GStreamer players when they're disabled.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:

(WebCore::MediaPlayerPrivateGStreamer::durationMediaTime):
Use doubles instead of floats.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

Use doubles instead of floats for m_durationAtEOS.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:

Don't reset m_sample on videoSink drain, it causes too many problems.
(WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:

Removed unused methods.

  • platform/graphics/gstreamer/VideoSinkGStreamer.cpp:

Keep releasing m_sample on drain, but don't report the event
externally via signal anymore. The base player private isn't
listening to it anymore.
(webkitVideoSinkEvent):
(webkit_video_sink_class_init):

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

(WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
Check if the demuxer caps correspond to a supported codec.
(WebCore::AppendPipeline::didReceiveInitializationSegment):
Empty m_track is now legal and means unsupported codec.
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
Warn about more than one stream, but "support" it by ignoring it using
a black hole probe.
(WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
Also report the duration when it's detected for the first time. Invalid
stream types now mean that unsupported codecs have been detected.
Complete init segment processing in that case.
(WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
Disconnect black hole probe.
(WebCore::appendPipelineDemuxerBlackHolePadProbe): Ignore buffers.
(WebCore::appendPipelineDemuxerPadRemoved): New parameter used.

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

(WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodecs):
Check supported codecs by matching against wildcard expressions.
(WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
Check for supported codecs.

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

New supportsCodecs() method.

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

(WebCore::MediaSourceClientGStreamerMSE::resetParserState):
Implemented parser resetting by aborting the AppendPipeline.

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

Added resetParserState().

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

(WebCore::SourceBufferPrivateGStreamer::resetParserState):
Implemented it.

  • testing/Internals.cpp:

(WebCore::Internals::initializeMockMediaSource):
Disable the GStreamer players when initializing the mock media source,
like it's already done for the AVFoundation player to force the
selection of MockMediaPlayerMediaSource.

Source/WebKit2:

  • Shared/WebPreferencesDefinitions.h:

New GStreamerEnabled preference, defaults to true.

  • WebProcess/WebPage/WebPage.cpp: Ditto.

(WebKit::WebPage::updatePreferences):

Source/WTF:

  • wtf/glib/GLibUtilities.h:

Added new macros to convert gulong to/from gpointer.

Tools:

  • Scripts/webkitperl/FeatureList.pm: Re-enable MEDIA_SOURCE for the GTK+ port.

LayoutTests:

  • media/media-source/media-source-resize-expected.txt:

Expect the resize event.

  • media/media-source/media-source-resize.html:

The test now succeeds no matter if the dimension is reported after
processing the init-segment (GTK+ case) or after the media segment
is processed (Mac case).

  • platform/gtk/TestExpectations:

Reenabled all the media/media-source tests except one.

  • platform/gtk/media/media-source/media-source-resize-expected.txt:

Copied from LayoutTests/media/media-source/media-source-resize-expected.txt.
The right dimensions are received earlier than in Mac.

Location:
trunk
Files:
1 added
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r209794 r209797  
     12016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
     2
     3        REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
     4        https://bugs.webkit.org/show_bug.cgi?id=164022
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        * media/media-source/media-source-resize-expected.txt:
     9        Expect the resize event.
     10        * media/media-source/media-source-resize.html:
     11        The test now succeeds no matter if the dimension is reported after
     12        processing the init-segment (GTK+ case) or after the media segment
     13        is processed (Mac case).
     14        * platform/gtk/TestExpectations:
     15        Reenabled all the media/media-source tests except one.
     16        * platform/gtk/media/media-source/media-source-resize-expected.txt:
     17        Copied from LayoutTests/media/media-source/media-source-resize-expected.txt.
     18        The right dimensions are received earlier than in Mac.
     19
    1202016-12-13  Yusuke Suzuki  <utatane.tea@gmail.com>
    221
  • trunk/LayoutTests/media/media-source/media-source-resize-expected.txt

    r207584 r209797  
    66RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
    77RUN(sourceBuffer.appendBuffer(loader.initSegment()))
     8EVENT(resize)
    89EVENT(update)
    910Append a media segment.
  • trunk/LayoutTests/media/media-source/media-source-resize.html

    r207584 r209797  
    3333        run('sourceBuffer = source.addSourceBuffer(loader.type())');
    3434        waitForEventOn(sourceBuffer, 'update', sourceInitialized, false, true);
     35        waitForEventOnce('resize', resize);
    3536        run('sourceBuffer.appendBuffer(loader.initSegment())');
    3637    }
     
    4344
    4445    function resize() {
    45         testExpected('video.videoWidth', 640);
    46         testExpected('video.videoHeight', 480);
    47         endTest();
     46        // First resize can be 0x0 (Mac) or 640x480 (GTK+)
     47        if (video.videoWidth > 0 && video.videoHeight > 0) {
     48            testExpected('video.videoWidth', 640);
     49            testExpected('video.videoHeight', 480);
     50            endTest();
     51        }
    4852    }
    4953    </script>
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r209648 r209797  
    232232webkit.org/b/92749 fast/dom/NavigatorContentUtils/is-protocol-handler-registered.html [ Skip ]
    233233
    234 # Tests for MediaSource API. Feature is not totally functional.
     234# Tests for MediaSource API. Webm is required by the tests but we don't support it.
    235235webkit.org/b/99065 imported/w3c/web-platform-tests/media-source/ [ Skip ]
     236
     237# We don't support multiple streams per sourcebuffer nor dynamic type changes (audio/video/text)
     238webkit.org/b/165394 media/media-source/media-source-seek-detach-crash.html [ Skip ]
    236239
    237240# Encrypted Media Extensions are not enabled.
     
    28892892webkit.org/b/160119 fast/css3-text/css3-text-justify/text-justify-last-line-simple-line-layout.html [ ImageOnlyFailure ]
    28902893
    2891 webkit.org/b/164022 media/media-source [ Skip ]
    2892 
    28932894#////////////////////////////////////////////////////////////////////////////////////////
    28942895# End of tests failing due to THREADED COMPOSITOR enablement. Don't put random test
  • trunk/LayoutTests/platform/gtk/media/media-source/media-source-resize-expected.txt

    r209796 r209797  
    66RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
    77RUN(sourceBuffer.appendBuffer(loader.initSegment()))
    8 EVENT(update)
    9 Append a media segment.
    10 RUN(sourceBuffer.appendBuffer(loader.mediaSegment(0)))
    118EVENT(resize)
    129EXPECTED (video.videoWidth == '640') OK
  • trunk/Source/WTF/ChangeLog

    r209795 r209797  
     12016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
     2
     3        REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
     4        https://bugs.webkit.org/show_bug.cgi?id=164022
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        * wtf/glib/GLibUtilities.h:
     9        Added new macros to convert gulong to/from gpointer.
     10
    1112016-12-14  Gavin Barraclough  <barraclough@apple.com>
    212
  • trunk/Source/WTF/wtf/glib/GLibUtilities.h

    r185502 r209797  
    2626CString getCurrentExecutablePath();
    2727
     28// These might be added to glib in the future, but in the meantime they're defined here.
     29#ifndef GULONG_TO_POINTER
     30#define GULONG_TO_POINTER(ul) ((gpointer) (gulong) (ul))
    2831#endif
     32
     33#ifndef GPOINTER_TO_ULONG
     34#define GPOINTER_TO_ULONG(p) ((gulong) (p))
     35#endif
     36
     37#endif
  • trunk/Source/WebCore/ChangeLog

    r209796 r209797  
     12016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
     2
     3        REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
     4        https://bugs.webkit.org/show_bug.cgi?id=164022
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Covered by existing tests.
     9
     10        * page/Settings.cpp:
     11        Added new setting to disable GStreamer players, so the selection of
     12        MockMediaPlayerMediaSource can be forced for some tests, just like
     13        it's already being done for the AVFoundation player in Mac.
     14        (WebCore::Settings::setGStreamerEnabled):
     15        * page/Settings.h:
     16        (WebCore::Settings::isGStreamerEnabled):
     17        * platform/graphics/MediaPlayer.cpp:
     18        (WebCore::buildMediaEnginesVector):
     19        Don't register GStreamer players when they're disabled.
     20        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     21        (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime):
     22        Use doubles instead of floats.
     23        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
     24        Use doubles instead of floats for m_durationAtEOS.
     25        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     26        Don't reset m_sample on videoSink drain, it causes too many problems.
     27        (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
     28        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
     29        Removed unused methods.
     30        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
     31        Keep releasing m_sample on drain, but don't report the event
     32        externally via signal anymore. The base player private isn't
     33        listening to it anymore.
     34        (webkitVideoSinkEvent):
     35        (webkit_video_sink_class_init):
     36        * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
     37        (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
     38        Check if the demuxer caps correspond to a supported codec.
     39        (WebCore::AppendPipeline::didReceiveInitializationSegment):
     40        Empty m_track is now legal and means unsupported codec.
     41        (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
     42        Warn about more than one stream, but "support" it by ignoring it using
     43        a black hole probe.
     44        (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
     45        Also report the duration when it's detected for the first time. Invalid
     46        stream types now mean that unsupported codecs have been detected.
     47        Complete init segment processing in that case.
     48        (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
     49        Disconnect black hole probe.
     50        (WebCore::appendPipelineDemuxerBlackHolePadProbe): Ignore buffers.
     51        (WebCore::appendPipelineDemuxerPadRemoved): New parameter used.
     52        * platform/graphics/gstreamer/mse/AppendPipeline.h:
     53        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
     54        (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodecs):
     55        Check supported codecs by matching against wildcard expressions.
     56        (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
     57        Check for supported codecs.
     58        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
     59        New supportsCodecs() method.
     60        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
     61        (WebCore::MediaSourceClientGStreamerMSE::resetParserState):
     62        Implemented parser resetting by aborting the AppendPipeline.
     63        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
     64        Added resetParserState().
     65        * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
     66        (WebCore::SourceBufferPrivateGStreamer::resetParserState):
     67        Implemented it.
     68        * testing/Internals.cpp:
     69        (WebCore::Internals::initializeMockMediaSource):
     70        Disable the GStreamer players when initializing the mock media source,
     71        like it's already done for the AVFoundation player to force the
     72        selection of MockMediaPlayerMediaSource.
     73
    1742016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
    275
  • trunk/Source/WebCore/page/Settings.cpp

    r209465 r209797  
    8282#if PLATFORM(COCOA)
    8383bool Settings::gQTKitEnabled = false;
     84#endif
     85
     86#if USE(GSTREAMER)
     87bool Settings::gGStreamerEnabled = true;
    8488#endif
    8589
     
    583587#endif
    584588
     589#if USE(GSTREAMER)
     590void Settings::setGStreamerEnabled(bool enabled)
     591{
     592    if (gGStreamerEnabled == enabled)
     593        return;
     594
     595    gGStreamerEnabled = enabled;
     596    HTMLMediaElement::resetMediaEngines();
     597}
     598#endif
     599
    585600#if ENABLE(MEDIA_STREAM)
    586601bool Settings::mockCaptureDevicesEnabled()
  • trunk/Source/WebCore/page/Settings.h

    r208982 r209797  
    219219#endif
    220220
     221#if USE(GSTREAMER)
     222    WEBCORE_EXPORT static void setGStreamerEnabled(bool flag);
     223    static bool isGStreamerEnabled() { return gGStreamerEnabled; }
     224#endif
     225
    221226    static const unsigned defaultMaximumHTMLParserDOMTreeDepth = 512;
    222227    static const unsigned defaultMaximumRenderTreeDepth = 512;
     
    377382#endif
    378383
     384#if USE(GSTREAMER)
     385    WEBCORE_EXPORT static bool gGStreamerEnabled;
     386#endif
     387
    379388    static bool gMockScrollbarsEnabled;
    380389    static bool gUsesOverlayScrollbars;
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp

    r208151 r209797  
    226226
    227227#if ENABLE(MEDIA_STREAM) && USE(GSTREAMER) && USE(OPENWEBRTC)
    228     MediaPlayerPrivateGStreamerOwr::registerMediaEngine(addMediaEngine);
     228    if (Settings::isGStreamerEnabled())
     229        MediaPlayerPrivateGStreamerOwr::registerMediaEngine(addMediaEngine);
    229230#endif
    230231
    231232#if defined(PlatformMediaEngineClassName)
    232     PlatformMediaEngineClassName::registerMediaEngine(addMediaEngine);
     233#if USE(GSTREAMER)
     234    if (Settings::isGStreamerEnabled())
     235#endif
     236        PlatformMediaEngineClassName::registerMediaEngine(addMediaEngine);
    233237#endif
    234238
    235239#if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE) && ENABLE(VIDEO_TRACK)
    236     MediaPlayerPrivateGStreamerMSE::registerMediaEngine(addMediaEngine);
     240    if (Settings::isGStreamerEnabled())
     241        MediaPlayerPrivateGStreamerMSE::registerMediaEngine(addMediaEngine);
    237242#endif
    238243
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r209796 r209797  
    428428
    429429    if (m_durationAtEOS)
    430         return MediaTime::createWithFloat(m_durationAtEOS);
     430        return MediaTime::createWithDouble(m_durationAtEOS);
    431431
    432432    // The duration query would fail on a not-prerolled pipeline.
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

    r207885 r209797  
    181181    mutable bool m_isEndReached;
    182182    mutable bool m_isStreaming;
    183     mutable gfloat m_durationAtEOS;
     183    mutable gdouble m_durationAtEOS;
    184184    bool m_paused;
    185185    float m_playbackRate;
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r209549 r209797  
    685685}
    686686
    687 void MediaPlayerPrivateGStreamerBase::triggerDrain()
    688 {
    689     WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
    690     m_videoSize = FloatSize();
    691     m_sample = nullptr;
    692 }
    693 
    694687void MediaPlayerPrivateGStreamerBase::repaintCallback(MediaPlayerPrivateGStreamerBase* player, GstSample* sample)
    695688{
    696689    player->triggerRepaint(sample);
    697 }
    698 
    699 void MediaPlayerPrivateGStreamerBase::drainCallback(MediaPlayerPrivateGStreamerBase* player)
    700 {
    701     player->triggerDrain();
    702690}
    703691
     
    10371025        m_videoSink = webkitVideoSinkNew();
    10381026        g_signal_connect_swapped(m_videoSink.get(), "repaint-requested", G_CALLBACK(repaintCallback), this);
    1039         g_signal_connect_swapped(m_videoSink.get(), "drain", G_CALLBACK(drainCallback), this);
    10401027    }
    10411028
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h

    r208676 r209797  
    167167    virtual bool handleSyncMessage(GstMessage*);
    168168
    169     void triggerDrain();
    170 
    171169    void triggerRepaint(GstSample*);
    172170    void repaint();
    173171
    174     static void drainCallback(MediaPlayerPrivateGStreamerBase*);
    175172    static void repaintCallback(MediaPlayerPrivateGStreamerBase*, GstSample*);
    176173
  • trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp

    r207874 r209797  
    5959enum {
    6060    REPAINT_REQUESTED,
    61     DRAIN,
    6261    LAST_SIGNAL
    6362};
     
    356355}
    357356
    358 static gboolean webkitVideoSinkQuery(GstBaseSink* baseSink, GstQuery* query)
    359 {
    360     WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(baseSink);
    361 
    362     switch (GST_QUERY_TYPE(query)) {
    363     case GST_QUERY_DRAIN:
    364         GST_OBJECT_LOCK(sink);
    365         g_signal_emit(sink, webkitVideoSinkSignals[DRAIN], 0);
    366         GST_OBJECT_UNLOCK(sink);
    367         return TRUE;
    368     default:
    369         return GST_CALL_PARENT_WITH_DEFAULT(GST_BASE_SINK_CLASS, query, (baseSink, query), TRUE);
    370     }
    371 }
    372 
    373357static gboolean webkitVideoSinkEvent(GstBaseSink* baseSink, GstEvent* event)
    374358{
     
    378362        sink->priv->scheduler.drain();
    379363
    380         GST_DEBUG_OBJECT(sink, "Flush-start, emitting DRAIN signal and releasing m_sample");
    381 
    382         GST_OBJECT_LOCK(sink);
    383         g_signal_emit(sink, webkitVideoSinkSignals[DRAIN], 0);
    384         GST_OBJECT_UNLOCK(sink);
     364        GST_DEBUG_OBJECT(sink, "Flush-start, releasing m_sample");
    385365        }
    386366        FALLTHROUGH;
     
    411391    baseSinkClass->set_caps = webkitVideoSinkSetCaps;
    412392    baseSinkClass->propose_allocation = webkitVideoSinkProposeAllocation;
    413     baseSinkClass->query = webkitVideoSinkQuery;
    414393    baseSinkClass->event = webkitVideoSinkEvent;
    415394
     
    424403            1, // Only one parameter
    425404            GST_TYPE_SAMPLE);
    426 
    427     webkitVideoSinkSignals[DRAIN] = g_signal_new("drain",
    428         G_TYPE_FROM_CLASS(klass),
    429         static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
    430         0, // Class offset.
    431         0, // Accumulator.
    432         0, // Accumulator data.
    433         g_cclosure_marshal_generic,
    434         G_TYPE_NONE, // Return type.
    435         0); // No parameters.
    436405}
    437406
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp

    r207894 r209797  
    4040#include <gst/video/video.h>
    4141#include <wtf/Condition.h>
     42#include <wtf/glib/GLibUtilities.h>
    4243
    4344namespace WebCore {
     
    7576static GstPadProbeReturn appendPipelinePadProbeDebugInformation(GstPad*, GstPadProbeInfo*, struct PadProbeInformation*);
    7677#endif
     78static GstPadProbeReturn appendPipelineDemuxerBlackHolePadProbe(GstPad*, GstPadProbeInfo*, gpointer);
    7779static GstFlowReturn appendPipelineAppsinkNewSample(GstElement*, AppendPipeline*);
    7880static void appendPipelineAppsinkEOS(GstElement*, AppendPipeline*);
     
    531533        const gchar* originalMediaType = gst_structure_get_string(structure, "original-media-type");
    532534
    533         if (g_str_has_prefix(originalMediaType, "video/")) {
     535        if (!MediaPlayerPrivateGStreamerMSE::supportsCodecs(originalMediaType)) {
     536            m_presentationSize = WebCore::FloatSize();
     537            m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Invalid;
     538        } else if (g_str_has_prefix(originalMediaType, "video/")) {
    534539            int width = 0;
    535540            int height = 0;
     
    561566        GstVideoInfo info;
    562567
    563         if (g_str_has_prefix(structureName, "video/") && gst_video_info_from_caps(&info, demuxerSrcPadCaps)) {
     568        if (!MediaPlayerPrivateGStreamerMSE::supportsCodecs(structureName)) {
     569            m_presentationSize = WebCore::FloatSize();
     570            m_streamType = WebCore::MediaSourceStreamTypeGStreamer::Invalid;
     571        } else if (g_str_has_prefix(structureName, "video/") && gst_video_info_from_caps(&info, demuxerSrcPadCaps)) {
    564572            float width, height;
    565573
     
    705713    WebCore::SourceBufferPrivateClient::InitializationSegment initializationSegment;
    706714
    707     GST_DEBUG("Notifying SourceBuffer for track %s", m_track->id().string().utf8().data());
     715    GST_DEBUG("Notifying SourceBuffer for track %s", (m_track) ? m_track->id().string().utf8().data() : nullptr);
    708716    initializationSegment.duration = m_mediaSourceClient->duration();
     717
    709718    switch (m_streamType) {
    710719    case Audio: {
     
    723732    }
    724733    default:
    725         GST_ERROR("Unsupported or unknown stream type");
    726         ASSERT_NOT_REACHED();
     734        GST_ERROR("Unsupported stream type or codec");
    727735        break;
    728736    }
     
    872880    GST_DEBUG("connecting to appsink");
    873881
     882    if (m_demux->numsrcpads > 1) {
     883        GST_WARNING("Only one stream per SourceBuffer is allowed! Ignoring stream %d by adding a black hole probe.", m_demux->numsrcpads);
     884        gulong probeId = gst_pad_add_probe(demuxerSrcPad, GST_PAD_PROBE_TYPE_BUFFER, reinterpret_cast<GstPadProbeCallback>(appendPipelineDemuxerBlackHolePadProbe), nullptr, nullptr);
     885        g_object_set_data(G_OBJECT(demuxerSrcPad), "blackHoleProbeId", GULONG_TO_POINTER(probeId));
     886        return;
     887    }
     888
    874889    GRefPtr<GstPad> appsinkSinkPad = adoptGRef(gst_element_get_static_pad(m_appsink.get(), "sink"));
    875890
     
    960975#endif
    961976
    962     if (m_initialDuration > m_mediaSourceClient->duration())
     977    if (m_initialDuration > m_mediaSourceClient->duration()
     978        || (m_mediaSourceClient->duration().isInvalid() && m_initialDuration > MediaTime::zeroTime()))
    963979        m_mediaSourceClient->durationChanged(m_initialDuration);
    964980
     
    979995        m_track = WebCore::InbandTextTrackPrivateGStreamer::create(id(), sinkSinkPad.get());
    980996        break;
     997    case WebCore::MediaSourceStreamTypeGStreamer::Invalid:
     998        {
     999            GUniquePtr<gchar> strcaps(gst_caps_to_string(caps.get()));
     1000            GST_DEBUG("Unsupported track codec: %s", strcaps.get());
     1001        }
     1002        // This is going to cause an error which will detach the SourceBuffer and tear down this
     1003        // AppendPipeline, so we need the padAddRemove lock released before continuing.
     1004        m_track = nullptr;
     1005        m_padAddRemoveCondition.notifyOne();
     1006        locker.unlockEarly();
     1007        didReceiveInitializationSegment();
     1008        return;
    9811009    default:
    9821010        // No useful data, but notify anyway to complete the append operation.
     
    9891017}
    9901018
    991 void AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread()
    992 {
     1019void AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread(GstPad* demuxerSrcPad)
     1020{
     1021    // Must be done in the thread we were called from (usually streaming thread).
     1022    if (!gst_pad_is_linked(demuxerSrcPad)) {
     1023        gulong probeId = GPOINTER_TO_ULONG(g_object_get_data(G_OBJECT(demuxerSrcPad), "blackHoleProbeId"));
     1024        if (probeId) {
     1025            GST_DEBUG("Disconnecting black hole probe.");
     1026            g_object_set_data(G_OBJECT(demuxerSrcPad), "blackHoleProbeId", nullptr);
     1027            gst_pad_remove_probe(demuxerSrcPad, probeId);
     1028        } else
     1029            GST_WARNING("Not disconnecting demuxer src pad because it wasn't linked");
     1030        return;
     1031    }
     1032
    9931033    GST_DEBUG("Disconnecting appsink");
    9941034
    995     // Must be done in the thread we were called from (usually streaming thread).
    9961035#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
    9971036    if (m_decryptor) {
     
    10371076#endif
    10381077
     1078static GstPadProbeReturn appendPipelineDemuxerBlackHolePadProbe(GstPad*, GstPadProbeInfo* info, gpointer)
     1079{
     1080    ASSERT(GST_PAD_PROBE_INFO_TYPE(info) & GST_PAD_PROBE_TYPE_BUFFER);
     1081    GstBuffer* buffer = GST_PAD_PROBE_INFO_BUFFER(info);
     1082    GST_TRACE("buffer of size %" G_GSIZE_FORMAT " ignored", gst_buffer_get_size(buffer));
     1083    return GST_PAD_PROBE_DROP;
     1084}
     1085
    10391086static void appendPipelineAppsrcNeedData(GstAppSrc*, guint, AppendPipeline* appendPipeline)
    10401087{
     
    10471094}
    10481095
    1049 static void appendPipelineDemuxerPadRemoved(GstElement*, GstPad*, AppendPipeline* appendPipeline)
    1050 {
    1051     appendPipeline->disconnectDemuxerSrcPadFromAppsinkFromAnyThread();
     1096static void appendPipelineDemuxerPadRemoved(GstElement*, GstPad* demuxerSrcPad, AppendPipeline* appendPipeline)
     1097{
     1098    appendPipeline->disconnectDemuxerSrcPadFromAppsinkFromAnyThread(demuxerSrcPad);
    10521099}
    10531100
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.h

    r207894 r209797  
    7878    WebCore::MediaSourceStreamTypeGStreamer streamType() { return m_streamType; }
    7979
    80     void disconnectDemuxerSrcPadFromAppsinkFromAnyThread();
     80    void disconnectDemuxerSrcPadFromAppsinkFromAnyThread(GstPad*);
    8181    void connectDemuxerSrcPadToAppsinkFromAnyThread(GstPad*);
    8282    void connectDemuxerSrcPadToAppsink(GstPad*);
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp

    r209796 r209797  
    4242#include "VideoTrackPrivateGStreamer.h"
    4343
     44#include <fnmatch.h>
    4445#include <gst/app/gstappsink.h>
    4546#include <gst/app/gstappsrc.h>
     
    750751}
    751752
     753bool MediaPlayerPrivateGStreamerMSE::supportsCodecs(const String& codecs)
     754{
     755    static Vector<const char*> supportedCodecs = { "avc*", "mp4a*", "mpeg", "x-h264" };
     756    Vector<String> codecEntries;
     757    codecs.split(',', false, codecEntries);
     758
     759    for (String codec : codecEntries) {
     760        bool isCodecSupported = false;
     761
     762        // If the codec is named like a mimetype (eg: video/avc) remove the "video/" part.
     763        size_t slashIndex = codec.find('/');
     764        if (slashIndex != WTF::notFound)
     765            codec = codec.substring(slashIndex+1);
     766
     767        const char* codecData = codec.utf8().data();
     768        for (const auto& pattern : supportedCodecs) {
     769            if (isCodecSupported = !fnmatch(pattern, codecData, 0))
     770                break;
     771        }
     772        if (!isCodecSupported)
     773            return false;
     774    }
     775
     776    return true;
     777}
     778
    752779MediaPlayer::SupportsType MediaPlayerPrivateGStreamerMSE::supportsType(const MediaEngineSupportParameters& parameters)
    753780{
     
    767794
    768795    // Spec says we should not return "probably" if the codecs string is empty.
    769     if (mimeTypeCache().contains(parameters.type))
    770         result = parameters.codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
     796    if (mimeTypeCache().contains(parameters.type)) {
     797        if (parameters.codecs.isEmpty())
     798            result = MediaPlayer::MayBeSupported;
     799        else
     800            result = supportsCodecs(parameters.codecs) ? MediaPlayer::IsSupported : MediaPlayer::IsNotSupported;
     801    }
    771802
    772803    return extendedSupportsType(parameters, result);
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h

    r207881 r209797  
    8888    void notifySeekNeedsDataForTime(const MediaTime&);
    8989
     90    static bool supportsCodecs(const String& codecs);
     91
    9092private:
    9193    static void getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>&);
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp

    r207878 r209797  
    105105}
    106106
     107void MediaSourceClientGStreamerMSE::resetParserState(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate)
     108{
     109    ASSERT(WTF::isMainThread());
     110
     111    GST_DEBUG("resetting parser state");
     112
     113    if (!m_playerPrivate)
     114        return;
     115
     116    RefPtr<AppendPipeline> appendPipeline = m_playerPrivate->m_appendPipelinesMap.get(sourceBufferPrivate);
     117
     118    ASSERT(appendPipeline);
     119
     120    appendPipeline->abort();
     121}
     122
    107123bool MediaSourceClientGStreamerMSE::append(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate, const unsigned char* data, unsigned length)
    108124{
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h

    r207878 r209797  
    4848    // From SourceBufferPrivateGStreamer.
    4949    void abort(RefPtr<SourceBufferPrivateGStreamer>);
     50    void resetParserState(RefPtr<SourceBufferPrivateGStreamer>);
    5051    bool append(RefPtr<SourceBufferPrivateGStreamer>, const unsigned char*, unsigned);
    5152    void removedFromMediaSource(RefPtr<SourceBufferPrivateGStreamer>);
  • trunk/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp

    r207879 r209797  
    8787void SourceBufferPrivateGStreamer::resetParserState()
    8888{
    89     notImplemented();
     89    m_client->resetParserState(this);
    9090}
    9191
  • trunk/Source/WebCore/testing/Internals.cpp

    r209794 r209797  
    26942694    WebCore::Settings::setAVFoundationEnabled(false);
    26952695#endif
     2696#if USE(GSTREAMER)
     2697    WebCore::Settings::setGStreamerEnabled(false);
     2698#endif
    26962699    MediaPlayerFactorySupport::callRegisterMediaEngine(MockMediaPlayerMediaSource::registerMediaEngine);
    26972700}
  • trunk/Source/WebKit2/ChangeLog

    r209793 r209797  
     12016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
     2
     3        REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
     4        https://bugs.webkit.org/show_bug.cgi?id=164022
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        * Shared/WebPreferencesDefinitions.h:
     9        New GStreamerEnabled preference, defaults to true.
     10        * WebProcess/WebPage/WebPage.cpp: Ditto.
     11        (WebKit::WebPage::updatePreferences):
     12
    1132016-12-13  Commit Queue  <commit-queue@webkit.org>
    214
  • trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h

    r209643 r209797  
    153153    macro(AVFoundationEnabled, isAVFoundationEnabled, Bool, bool, true, "", "") \
    154154    macro(AVFoundationNSURLSessionEnabled, isAVFoundationNSURLSessionEnabled, Bool, bool, true, "", "") \
     155    macro(GStreamerEnabled, isGStreamerEnabled, Bool, bool, true, "", "") \
    155156    macro(RequiresUserGestureForMediaPlayback, requiresUserGestureForMediaPlayback, Bool, bool, false, "", "") \
    156157    macro(RequiresUserGestureForVideoPlayback, requiresUserGestureForVideoPlayback, Bool, bool, false, "", "") \
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r209757 r209797  
    30213021#endif
    30223022
     3023#if USE(GSTREAMER)
     3024    settings.setGStreamerEnabled(store.getBoolValueForKey(WebPreferencesKey::isGStreamerEnabledKey()));
     3025#endif
     3026
    30233027#if PLATFORM(COCOA)
    30243028    settings.setQTKitEnabled(store.getBoolValueForKey(WebPreferencesKey::isQTKitEnabledKey()));
  • trunk/Tools/ChangeLog

    r209786 r209797  
     12016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
     2
     3        REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
     4        https://bugs.webkit.org/show_bug.cgi?id=164022
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        * Scripts/webkitperl/FeatureList.pm:
     9          Re-enable MEDIA_SOURCE for the GTK+ port.
     10
    1112016-12-13  Alex Christensen  <achristensen@webkit.org>
    212
  • trunk/Tools/Scripts/webkitperl/FeatureList.pm

    r209310 r209797  
    335335
    336336    { option => "media-source", desc => "Toggle Media Source support",
    337       define => "ENABLE_MEDIA_SOURCE", default => 0, value => \$mediaSourceSupport },
     337      define => "ENABLE_MEDIA_SOURCE", default => isGtk(), value => \$mediaSourceSupport },
    338338
    339339    { option => "media-statistics", desc => "Toggle Media Statistics support",
Note: See TracChangeset for help on using the changeset viewer.