Title: [285352] branches/safari-613.1.7-branch/Source/WebCore
- Revision
- 285352
- Author
- repst...@apple.com
- Date
- 2021-11-05 12:53:42 -0700 (Fri, 05 Nov 2021)
Log Message
Cherry-pick r285305. rdar://problem/85082384
[ iOS ] TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS is crashing
https://bugs.webkit.org/show_bug.cgi?id=232676
Patch by Alex Christensen <achristen...@webkit.org> on 2021-11-04
Reviewed by Eric Carlson.
In WebKitLegacy on iOS, WebCoreAVFPullDelegate.initWithPlayer is being called on the web thread,
but outputMediaDataWillChange is being called on the main run loop then accessing _player in a non-thread-safe manner.
To fix this, I call callOnMainThread to access _player on the web thread. To fix the assertion that happens after this
fix, I made MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange able to be called on the non-main run loop.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
(-[WebCoreAVFPullDelegate outputMediaDataWillChange:]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-613.1.7-branch/Source/WebCore/ChangeLog (285351 => 285352)
--- branches/safari-613.1.7-branch/Source/WebCore/ChangeLog 2021-11-05 19:53:38 UTC (rev 285351)
+++ branches/safari-613.1.7-branch/Source/WebCore/ChangeLog 2021-11-05 19:53:42 UTC (rev 285352)
@@ -1,5 +1,42 @@
2021-11-05 Russell Epstein <repst...@apple.com>
+ Cherry-pick r285305. rdar://problem/85082384
+
+ [ iOS ] TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS is crashing
+ https://bugs.webkit.org/show_bug.cgi?id=232676
+
+ Patch by Alex Christensen <achristen...@webkit.org> on 2021-11-04
+ Reviewed by Eric Carlson.
+
+ In WebKitLegacy on iOS, WebCoreAVFPullDelegate.initWithPlayer is being called on the web thread,
+ but outputMediaDataWillChange is being called on the main run loop then accessing _player in a non-thread-safe manner.
+ To fix this, I call callOnMainThread to access _player on the web thread. To fix the assertion that happens after this
+ fix, I made MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange able to be called on the non-main run loop.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
+ (-[WebCoreAVFPullDelegate outputMediaDataWillChange:]):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-11-04 Alex Christensen <achristen...@webkit.org>
+
+ [ iOS ] TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS is crashing
+ https://bugs.webkit.org/show_bug.cgi?id=232676
+
+ Reviewed by Eric Carlson.
+
+ In WebKitLegacy on iOS, WebCoreAVFPullDelegate.initWithPlayer is being called on the web thread,
+ but outputMediaDataWillChange is being called on the main run loop then accessing _player in a non-thread-safe manner.
+ To fix this, I call callOnMainThread to access _player on the web thread. To fix the assertion that happens after this
+ fix, I made MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange able to be called on the non-main run loop.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange):
+ (-[WebCoreAVFPullDelegate outputMediaDataWillChange:]):
+
+2021-11-05 Russell Epstein <repst...@apple.com>
+
Cherry-pick r285231. rdar://problem/85082384
[ iOS ] TestWebKitAPI.WebKitLegacy.AudioSessionCategoryIOS is crashing
Modified: branches/safari-613.1.7-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (285351 => 285352)
--- branches/safari-613.1.7-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-11-05 19:53:38 UTC (rev 285351)
+++ branches/safari-613.1.7-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-11-05 19:53:42 UTC (rev 285352)
@@ -2633,8 +2633,15 @@
void MediaPlayerPrivateAVFoundationObjC::outputMediaDataWillChange()
{
- if (m_runningModalPaint)
- RunLoop::main().stop();
+ if (m_runningModalPaint) {
+ if (RunLoop::isMain())
+ RunLoop::main().stop();
+ else {
+ RunLoop::main().dispatch([] {
+ RunLoop::main().stop();
+ });
+ }
+ }
}
#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
@@ -4017,9 +4024,9 @@
{
UNUSED_PARAM(output);
m_semaphore.signal();
- RunLoop::main().dispatch([player = _player] {
- if (player)
- player->outputMediaDataWillChange();
+ callOnMainThread([self, strongSelf = RetainPtr { self }] {
+ if (_player)
+ _player->outputMediaDataWillChange();
});
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes