Commit 8d765e16 authored by Felix Paul Kühne's avatar Felix Paul Kühne

ios vout: fix unexpected termination when app is in background (close #14643)

parent c417e384
...@@ -328,8 +328,10 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub ...@@ -328,8 +328,10 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
sys->has_first_frame = true; sys->has_first_frame = true;
if (likely([sys->glESView isAppActive])) @synchronized (sys->glESView) {
vout_display_opengl_Display(sys->vgl, &vd->source); if (likely([sys->glESView isAppActive]))
vout_display_opengl_Display(sys->vgl, &vd->source);
}
picture_Release(pic); picture_Release(pic);
...@@ -404,7 +406,9 @@ static void OpenglESSwap(vlc_gl_t *gl) ...@@ -404,7 +406,9 @@ static void OpenglESSwap(vlc_gl_t *gl)
[self performSelectorOnMainThread:@selector(reshape) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(reshape) withObject:nil waitUntilDone:NO];
[self setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; [self setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
_appActive = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive); @synchronized (self) {
_appActive = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive);
}
return self; return self;
} }
...@@ -485,7 +489,7 @@ static void OpenglESSwap(vlc_gl_t *gl) ...@@ -485,7 +489,7 @@ static void OpenglESSwap(vlc_gl_t *gl)
vout_display_place_t place; vout_display_place_t place;
@synchronized(self) { @synchronized (self) {
if (_voutDisplay) { if (_voutDisplay) {
vout_display_cfg_t cfg_tmp = *(_voutDisplay->cfg); vout_display_cfg_t cfg_tmp = *(_voutDisplay->cfg);
CGFloat scaleFactor = self.contentScaleFactor; CGFloat scaleFactor = self.contentScaleFactor;
...@@ -519,12 +523,14 @@ static void OpenglESSwap(vlc_gl_t *gl) ...@@ -519,12 +523,14 @@ static void OpenglESSwap(vlc_gl_t *gl)
- (void)applicationStateChanged:(NSNotification *)notification - (void)applicationStateChanged:(NSNotification *)notification
{ {
@synchronized (self) {
if ([[notification name] isEqualToString:UIApplicationWillResignActiveNotification] if ([[notification name] isEqualToString:UIApplicationWillResignActiveNotification]
|| [[notification name] isEqualToString:UIApplicationDidEnterBackgroundNotification] || [[notification name] isEqualToString:UIApplicationDidEnterBackgroundNotification]
|| [[notification name] isEqualToString:UIApplicationWillTerminateNotification]) || [[notification name] isEqualToString:UIApplicationWillTerminateNotification])
_appActive = NO; _appActive = NO;
else else
_appActive = YES; _appActive = YES;
}
} }
- (void)updateConstraints - (void)updateConstraints
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment