Changeset 219681 in webkit


Ignore:
Timestamp:
Jul 20, 2017 6:07:01 AM (7 years ago)
Author:
magomez@igalia.com
Message:

[GStreamer] Some layout tests issue "g_mutex_clear() called on uninitialised or locked mutex" and flaky crash in ~MediaPlayerPrivateGStreamerBase
https://bugs.webkit.org/show_bug.cgi?id=173952

Reviewed by Carlos Garcia Campos.

Adjust MediaPlayerPrivateGStreamerBase to avoid concurrence problems with the GStreamer thread when
destroying the object.

Covered by existent tests.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:

(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::repaint):
(WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r219678 r219681  
     12017-07-20  Miguel Gomez  <magomez@igalia.com>
     2
     3        [GStreamer] Some layout tests issue "g_mutex_clear() called on uninitialised or locked mutex" and flaky crash in ~MediaPlayerPrivateGStreamerBase
     4        https://bugs.webkit.org/show_bug.cgi?id=173952
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Adjust MediaPlayerPrivateGStreamerBase to avoid concurrence problems with the GStreamer thread when
     9        destroying the object.
     10
     11        Covered by existent tests.
     12
     13        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     14        (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
     15        (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
     16        (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
     17
    1182017-07-19  Zan Dobersek  <zdobersek@igalia.com>
    219
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r219391 r219681  
    240240    m_notifier->invalidate();
    241241
    242     cancelRepaint();
    243 
    244242    if (m_videoSink) {
    245243        g_signal_handlers_disconnect_matched(m_videoSink.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
     
    252250    }
    253251
    254     g_mutex_clear(&m_sampleMutex);
    255 
    256     m_player = nullptr;
    257 
    258252    if (m_volumeElement)
    259253        g_signal_handlers_disconnect_matched(m_volumeElement.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
    260254
     255    // This will release the GStreamer thread from m_drawCondition if AC is disabled.
     256    cancelRepaint();
     257
     258    // The change to GST_STATE_NULL state is always synchronous. So after this gets executed we don't need to worry
     259    // about handlers running in the GStreamer thread.
    261260    if (m_pipeline)
    262261        gst_element_set_state(m_pipeline.get(), GST_STATE_NULL);
     262
     263    g_mutex_clear(&m_sampleMutex);
     264
     265    m_player = nullptr;
    263266}
    264267
     
    627630    m_player->repaint();
    628631
    629 #if USE(GSTREAMER_GL)
    630     bool shouldNotifyDraw = !m_renderingCanBeAccelerated;
    631 #else
    632     bool shouldNotifyDraw = true;
    633 #endif
    634     if (shouldNotifyDraw) {
    635         LockHolder lock(m_drawMutex);
    636         m_drawCondition.notifyOne();
    637     }
     632    LockHolder lock(m_drawMutex);
     633    m_drawCondition.notifyOne();
    638634}
    639635
     
    680676void MediaPlayerPrivateGStreamerBase::cancelRepaint()
    681677{
    682 #if USE(GSTREAMER_GL)
    683     bool shouldCancelRepaint = !m_renderingCanBeAccelerated;
    684 #else
    685     bool shouldCancelRepaint = true;
    686 #endif
    687     if (shouldCancelRepaint) {
     678    if (!m_renderingCanBeAccelerated) {
    688679        m_drawTimer.stop();
    689680        LockHolder locker(m_drawMutex);
Note: See TracChangeset for help on using the changeset viewer.