Skip to content

Commit

Permalink
Cherry-pick 270627@main (d0b51b0). https://bugs.webkit.org/show_bug.c…
Browse files Browse the repository at this point in the history
…gi?id=264705

    [GStreamer][EME][Debug] Flaky assertions on weak pointer
    https://bugs.webkit.org/show_bug.cgi?id=264705

    Reviewed by Xabier Rodriguez-Calvar.

    Replace ASSERTs on WeakPtr by runtime checks, the pointer can be null, it's a valid scenario, so it
    shouldn't be in an ASSERT.

    * Source/WebCore/platform/encryptedmedia/CDMProxy.cpp:
    (WebCore::CDMInstanceProxy::startedWaitingForKey):
    (WebCore::CDMInstanceProxy::stoppedWaitingForKey):

    Canonical link: https://commits.webkit.org/270627@main
  • Loading branch information
philn authored and aperezdc committed Jan 26, 2024
1 parent eb16a51 commit 97ea703
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Source/WebCore/platform/encryptedmedia/CDMProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ std::optional<KeyHandleValueVariant> CDMProxy::getOrWaitForKeyValue(const KeyIDT
void CDMInstanceProxy::startedWaitingForKey()
{
ASSERT(!isMainThread());
ASSERT(m_player.get());
if (!m_player.get())
return;

bool wasWaitingForKey = m_numDecryptorsWaitingForKey > 0;
m_numDecryptorsWaitingForKey++;
Expand All @@ -368,7 +369,9 @@ void CDMInstanceProxy::startedWaitingForKey()
void CDMInstanceProxy::stoppedWaitingForKey()
{
ASSERT(!isMainThread());
ASSERT(m_player.get());
if (!m_player.get())
return;

ASSERT(m_numDecryptorsWaitingForKey > 0);
m_numDecryptorsWaitingForKey--;
bool isNobodyWaitingForKey = !m_numDecryptorsWaitingForKey;
Expand Down

0 comments on commit 97ea703

Please sign in to comment.