glimagesink: crash on iOS device
This issue 100% reproducible with GstPlay example project from subprojects/gst-examples/playback/player/ios/GstPlay
. I use gstreamer 1.22.1 and iPhone with iOS 15.5 (I think it does not matter the version of iOS).
Steps to reproduce:
- Create
stop
button and place it on VideoViewController in Xcode UI - Connect
stop
button to the function stop onVideoViewController.m
file - Implement
stop
function:
- (IBAction)stop:(id)sender {
gst_player_stop(player);
is_playing_desired = NO;
[UIApplication sharedApplication].idleTimerDisabled = NO;
}
- Run for debug app
GstPlay
- Select video from list (I used
http://techslides.com/demos/sample-videos/small.mp4
, this file added toOnlineMedia.plist
) - Press
play
button - After video playback is started (wait ~2 seconds) then press
stop
button - Press
Back
(< Library
on iOS) button - Crash
backtrace:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xf84fc13d0340)
frame #0: 0x00000001a9eb2f40 libobjc.A.dylib`objc_msgSend + 32
frame #1: 0x000000019376aea4 UIKitCore`_makeSubTreePerformSelector + 388
frame #2: 0x000000019376af04 UIKitCore`_makeSubTreePerformSelector + 484
frame #3: 0x000000019376af04 UIKitCore`_makeSubTreePerformSelector + 484
frame #4: 0x0000000193737504 UIKitCore`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 932
frame #5: 0x0000000193894330 UIKitCore`-[_UIParallaxDimmingView didMoveToWindow] + 180
frame #6: 0x0000000193865288 UIKitCore`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 2240
frame #7: 0x0000000193864d6c UIKitCore`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 932
frame #8: 0x000000019378b664 UIKitCore`__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 140
frame #9: 0x000000019381ad5c UIKitCore`-[UIView(Hierarchy) _postMovedFromSuperview:] + 812
frame #10: 0x00000001937379c8 UIKitCore`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 2152
frame #11: 0x000000019392821c UIKitCore`__53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_2 + 1552
frame #12: 0x00000001937207e0 UIKitCore`+[UIView(Animation) performWithoutAnimation:] + 104
frame #13: 0x00000001938616e0 UIKitCore`__53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 248
frame #14: 0x00000001939338d4 UIKitCore`+[UIView _performBlockDelayingTriggeringResponderEvents:forScene:] + 252
frame #15: 0x000000019393c6a8 UIKitCore`-[_UINavigationParallaxTransition animateTransition:] + 1096
frame #16: 0x0000000193a637a4 UIKitCore`___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 76
frame #17: 0x000000019388ff38 UIKitCore`+[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] + 116
frame #18: 0x0000000193f5da94 UIKitCore`___UIViewControllerTransitioningRunCustomTransition_block_invoke.663 + 204
frame #19: 0x0000000193992e7c UIKitCore`+[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 204
frame #20: 0x0000000193829178 UIKitCore`_UIViewControllerTransitioningRunCustomTransition + 628
frame #21: 0x00000001939259a8 UIKitCore`-[UINavigationController _startCustomTransition:] + 3580
frame #22: 0x0000000193a8313c UIKitCore`-[UINavigationController _startDeferredTransitionIfNeeded:] + 696
frame #23: 0x00000001939588e4 UIKitCore`-[UINavigationController __viewWillLayoutSubviews] + 168
frame #24: 0x00000001938802dc UIKitCore`-[UILayoutContainerView layoutSubviews] + 228
frame #25: 0x0000000193739fb4 UIKitCore`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2592
frame #26: 0x0000000194eb0cd0 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 532
frame #27: 0x0000000194ea3134 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 136
frame #28: 0x0000000194eb7a7c QuartzCore`CA::Context::commit_transaction(CA::Transaction*, double, double*) + 452
frame #29: 0x0000000194ec0970 QuartzCore`CA::Transaction::commit() + 704
frame #30: 0x0000000194ea288c QuartzCore`CA::Transaction::flush_as_runloop_observer(bool) + 88
frame #31: 0x00000001911750c4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
frame #32: 0x0000000191144080 CoreFoundation`__CFRunLoopDoObservers + 592
frame #33: 0x000000019113f13c CoreFoundation`__CFRunLoopRun + 1052
frame #34: 0x0000000191152bc8 CoreFoundation`CFRunLoopRunSpecific + 600
frame #35: 0x00000001ad286374 GraphicsServices`GSEventRunModal + 164
frame #36: 0x0000000193ac2648 UIKitCore`-[UIApplication _run] + 1100
frame #37: 0x0000000193843d90 UIKitCore`UIApplicationMain + 364
* frame #38: 0x0000000102ebc268 GstPlay`main(argc=1, argv=0x000000016cf4b798) at main.m:10:16
frame #39: 0x0000000107ad1ce4 dyld`start + 520
I have the same issue on complex pipeline. I think the problem in glimagesink
, because no crash if I set player = gst_player_new (gst_player_video_overlay_video_renderer_new (NULL), NULL);
(In my pipeline gst_video_overlay_set_window_handle
function). I believe somebody forgot to clean surface after usage or uses surface is not in main thread. No issue if I use pause
button instead of stop
.