Changeset 230627 in webkit


Ignore:
Timestamp:
Apr 13, 2018 3:09:23 AM (6 years ago)
Author:
magomez@igalia.com
Message:

[GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
https://bugs.webkit.org/show_bug.cgi?id=183362

Reviewed by Carlos Garcia Campos.

Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
has only effect when not in AC mode.

Covered by existent tests.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:

(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r230625 r230627  
     12018-04-13  Miguel Gomez  <magomez@igalia.com>
     2
     3        [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
     4        https://bugs.webkit.org/show_bug.cgi?id=183362
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
     9        That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
     10        can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
     11        has only effect when not in AC mode.
     12
     13        Covered by existent tests.
     14
     15        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     16        (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
     17        (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
     18        (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
     19        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
     20
    1212018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
    222
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r230625 r230627  
    241241MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase()
    242242{
     243    // Flag the player as being destroyed, so triggerRepaint will ignore incoming samples.
     244    m_destroying = true;
     245
    243246#if ENABLE(ENCRYPTED_MEDIA)
    244247    m_protectionCondition.notifyAll();
     
    259262        g_signal_handlers_disconnect_matched(m_volumeElement.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
    260263
    261     // This will release the GStreamer thread from m_drawCondition if AC is disabled.
     264    // This will release the GStreamer thread from m_drawCondition in non AC mode in case there's an ongoing triggerRepaint call.
    262265    cancelRepaint();
    263266
     
    785788void MediaPlayerPrivateGStreamerBase::triggerRepaint(GstSample* sample)
    786789{
     790    // Do not try to process new frames if the player is being destroyed by the main thread.
     791    if (m_destroying)
     792        return;
     793
    787794    bool triggerResize;
    788795    {
     
    799806    if (!m_renderingCanBeAccelerated) {
    800807        LockHolder locker(m_drawMutex);
    801         if (m_drawCancelled)
    802             return;
    803808        m_drawTimer.startOneShot(0_s);
    804809        m_drawCondition.wait(m_drawMutex);
     
    812817    {
    813818        LockHolder lock(m_drawMutex);
    814         if (m_drawCancelled)
    815             return;
    816819        if (!m_platformLayerProxy->scheduleUpdateOnCompositorThread([this] { this->pushTextureToCompositor(); }))
    817820            return;
     
    829832void MediaPlayerPrivateGStreamerBase::cancelRepaint()
    830833{
    831     LockHolder locker(m_drawMutex);
    832 
     834    // The goal of this function is to release the GStreamer thread from m_drawCondition in triggerRepaint() in non-AC case,
     835    // to avoid a deadlock if the player gets paused while waiting for drawing (see https://bugs.webkit.org/show_bug.cgi?id=170003):
     836    // the main thread is waiting for the GStreamer thread to pause, but the GStreamer thread is locked waiting for the
     837    // main thread to draw. This deadlock doesn't happen when using AC because the sample is processed (not painted) in the compositor
     838    // thread, so the main thread can request the pause and wait if the GStreamer thread is waiting for the compositor thread.
    833839    if (!m_renderingCanBeAccelerated) {
    834840        m_drawTimer.stop();
    835     }
    836 
    837     m_drawCancelled = true;
    838     m_drawCondition.notifyOne();
     841        LockHolder locker(m_drawMutex);
     842        m_drawCondition.notifyOne();
     843    }
    839844}
    840845
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h

    r230625 r230627  
    236236    Condition m_drawCondition;
    237237    Lock m_drawMutex;
    238     bool m_drawCancelled { false };
     238    bool m_destroying { false };
    239239    RunLoop::Timer<MediaPlayerPrivateGStreamerBase> m_drawTimer;
    240240
Note: See TracChangeset for help on using the changeset viewer.