Changeset 228271 in webkit


Ignore:
Timestamp:
Feb 8, 2018 5:10:48 AM (6 years ago)
Author:
Philippe Normand
Message:

[GStreamer] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subsequent test flaky crash
https://bugs.webkit.org/show_bug.cgi?id=173916

Reviewed by Xabier Rodriguez Calvar.

Source/WebCore:

This patch fixes two crashes and a runtime warning:

  • The provider client configuration should be done from the main

thread but the no-more-pads signal of deinterleave was fired from
a non-main thread.

  • The deinterleave pad-removed signal can be fired for a not fully

configured pipeline if the audio context is interrupted. So the
peer quark of the removed pad needs to be checked, it might be a
null pointer.

  • The provider connects to the deinterleave signals only when a

client is provided, so the signal disconnection needs to check
that to avoid runtime warnings.

  • platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:

(WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
Create a main thread notifier.
(WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
Invalidate notifier and check a client was set before
disconnecting from deinterleave signals.
(WebCore::AudioSourceProviderGStreamer::handleRemovedDeinterleavePad):
Check validity of the pad peer.
(WebCore::AudioSourceProviderGStreamer::deinterleavePadsConfigured):
Set client from main thread.

  • platform/audio/gstreamer/AudioSourceProviderGStreamer.h:

LayoutTests:

  • platform/gtk/TestExpectations: Unskip fixed test.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r228266 r228271  
     12018-02-08  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subsequent test flaky crash
     4        https://bugs.webkit.org/show_bug.cgi?id=173916
     5
     6        Reviewed by Xabier Rodriguez Calvar.
     7
     8        * platform/gtk/TestExpectations: Unskip fixed test.
     9
    1102018-02-06  Yusuke Suzuki  <utatane.tea@gmail.com>
    211
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r228112 r228271  
    12941294webkit.org/b/172955 media/video-preload.html [ Crash Pass ]
    12951295
    1296 webkit.org/b/173916 webaudio/silent-audio-interrupted-in-background.html [ Skip ]
    1297 
    12981296webkit.org/b/175575 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay-with-slow-text-tracks.html [ Crash Pass ]
    12991297
  • trunk/Source/WebCore/ChangeLog

    r228265 r228271  
     12018-02-08  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subsequent test flaky crash
     4        https://bugs.webkit.org/show_bug.cgi?id=173916
     5
     6        Reviewed by Xabier Rodriguez Calvar.
     7
     8        This patch fixes two crashes and a runtime warning:
     9
     10        - The provider client configuration should be done from the main
     11        thread but the no-more-pads signal of deinterleave was fired from
     12        a non-main thread.
     13
     14        - The deinterleave pad-removed signal can be fired for a not fully
     15        configured pipeline if the audio context is interrupted. So the
     16        peer quark of the removed pad needs to be checked, it might be a
     17        null pointer.
     18
     19        - The provider connects to the deinterleave signals only when a
     20        client is provided, so the signal disconnection needs to check
     21        that to avoid runtime warnings.
     22
     23        * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
     24        (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
     25        Create a main thread notifier.
     26        (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
     27        Invalidate notifier and check a client was set before
     28        disconnecting from deinterleave signals.
     29        (WebCore::AudioSourceProviderGStreamer::handleRemovedDeinterleavePad):
     30        Check validity of the pad peer.
     31        (WebCore::AudioSourceProviderGStreamer::deinterleavePadsConfigured):
     32        Set client from main thread.
     33        * platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
     34
    1352018-02-08  Philippe Normand  <pnormand@igalia.com>
    236
  • trunk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp

    r213445 r228271  
    8484
    8585AudioSourceProviderGStreamer::AudioSourceProviderGStreamer()
    86     : m_client(nullptr)
     86    : m_notifier(MainThreadNotifier<MainThreadNotification>::create())
     87    , m_client(nullptr)
    8788    , m_deinterleaveSourcePads(0)
    8889    , m_deinterleavePadAddedHandlerId(0)
     
    9798AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer()
    9899{
     100    m_notifier->invalidate();
     101
    99102    GRefPtr<GstElement> deinterleave = adoptGRef(gst_bin_get_by_name(GST_BIN(m_audioSinkBin.get()), "deinterleave"));
    100     if (deinterleave) {
     103    if (deinterleave && m_client) {
    101104        g_signal_handler_disconnect(deinterleave.get(), m_deinterleavePadAddedHandlerId);
    102105        g_signal_handler_disconnect(deinterleave.get(), m_deinterleaveNoMorePadsHandlerId);
     
    319322    // Remove the queue ! appsink chain downstream of deinterleave.
    320323    GQuark quark = g_quark_from_static_string("peer");
    321     GstPad* sinkPad = reinterpret_cast<GstPad*>(g_object_get_qdata(G_OBJECT(pad), quark));
     324    GstPad* sinkPad = GST_PAD_CAST(g_object_get_qdata(G_OBJECT(pad), quark));
     325    if (!sinkPad)
     326        return;
     327
    322328    GRefPtr<GstElement> queue = adoptGRef(gst_pad_get_parent_element(sinkPad));
    323329    GRefPtr<GstPad> queueSrcPad = adoptGRef(gst_element_get_static_pad(queue.get(), "src"));
     
    332338void AudioSourceProviderGStreamer::deinterleavePadsConfigured()
    333339{
    334     ASSERT(m_client);
    335     ASSERT(m_deinterleaveSourcePads == gNumberOfChannels);
    336 
    337     m_client->setFormat(m_deinterleaveSourcePads, gSampleBitRate);
     340    m_notifier->notify(MainThreadNotification::DeinterleavePadsConfigured, [this] {
     341        ASSERT(m_client);
     342        ASSERT(m_deinterleaveSourcePads == gNumberOfChannels);
     343
     344        m_client->setFormat(m_deinterleaveSourcePads, gSampleBitRate);
     345    });
    338346}
    339347
  • trunk/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.h

    r209871 r228271  
    2424#include "AudioSourceProvider.h"
    2525#include "GRefPtrGStreamer.h"
     26#include "MainThreadNotifier.h"
    2627#include <gst/gst.h>
    2728#include <wtf/Forward.h>
     
    5455
    5556private:
     57    enum MainThreadNotification {
     58        DeinterleavePadsConfigured = 1 << 0,
     59    };
     60    Ref<MainThreadNotifier<MainThreadNotification>> m_notifier;
    5661    GRefPtr<GstElement> m_audioSinkBin;
    5762    AudioSourceProviderClient* m_client;
Note: See TracChangeset for help on using the changeset viewer.