Skip to content

Commit 7f261cd

Browse files
committed
[GStreamer] Fix delayed dispatch of async task post MediaPlayer destruction
https://bugs.webkit.org/show_bug.cgi?id=266715 Reviewed by Philippe Normand. When the media player is destroyed, there can still be async tasks (from AbortableTaskQueue) ongoing, some of them related to tracks. Those tasks should be aborted, because they depend on objects that are no longer there. This patch aborts all pending tasks on AbortableTaskQueue destruction and also unregisters all pending callbacks from TrackPrivateBaseGStreamer. See: #1231 Original author: "Vivek.A" <[email protected]> * Source/WebCore/platform/AbortableTaskQueue.h: Abort tasks on destruction. * Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp: (WebCore::TrackPrivateBaseGStreamer::disconnect): Disconnect handlers. Canonical link: https://commits.webkit.org/272517@main
1 parent 15f9567 commit 7f261cd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Source/WebCore/platform/AbortableTaskQueue.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class AbortableTaskQueue final {
7575
ASSERT(isMainThread());
7676
ASSERT(!m_lock.isHeld());
7777
ASSERT(m_channel.isEmpty());
78+
startAborting();
7879
}
7980

8081
// ===========================

Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ void TrackPrivateBaseGStreamer::disconnect()
155155
m_bestUpstreamPad.clear();
156156
}
157157

158-
if (m_pad)
158+
if (m_pad) {
159+
g_signal_handlers_disconnect_matched(m_pad.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
159160
m_pad.clear();
161+
}
160162
}
161163

162164
void TrackPrivateBaseGStreamer::tagsChanged()

0 commit comments

Comments
 (0)