[vlc-commits] ios vout: fix unexpected termination when app is in background ( close #14643)

Felix Paul Kühne git at videolan.org
Tue May 26 19:50:38 CEST 2015


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue May 26 19:50:05 2015 +0200| [8d765e169785861bc63fc3234f5d4d16ca4c9940] | committer: Felix Paul Kühne

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8d765e169785861bc63fc3234f5d4d16ca4c9940
---

 modules/video_output/ios2.m |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/ios2.m b/modules/video_output/ios2.m
index c81a735..34f9318 100644
--- a/modules/video_output/ios2.m
+++ b/modules/video_output/ios2.m
@@ -328,8 +328,10 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub
 {
     vout_display_sys_t *sys = vd->sys;
     sys->has_first_frame = true;
-    if (likely([sys->glESView isAppActive]))
-        vout_display_opengl_Display(sys->vgl, &vd->source);
+    @synchronized (sys->glESView) {
+        if (likely([sys->glESView isAppActive]))
+            vout_display_opengl_Display(sys->vgl, &vd->source);
+    }
 
     picture_Release(pic);
 
@@ -404,7 +406,9 @@ static void OpenglESSwap(vlc_gl_t *gl)
     [self performSelectorOnMainThread:@selector(reshape) withObject:nil waitUntilDone:NO];
     [self setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
 
-    _appActive = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive);
+    @synchronized (self) {
+        _appActive = ([UIApplication sharedApplication].applicationState == UIApplicationStateActive);
+    }
 
     return self;
 }
@@ -485,7 +489,7 @@ static void OpenglESSwap(vlc_gl_t *gl)
 
     vout_display_place_t place;
 
-    @synchronized(self) {
+    @synchronized (self) {
         if (_voutDisplay) {
             vout_display_cfg_t cfg_tmp = *(_voutDisplay->cfg);
             CGFloat scaleFactor = self.contentScaleFactor;
@@ -519,12 +523,14 @@ static void OpenglESSwap(vlc_gl_t *gl)
 
 - (void)applicationStateChanged:(NSNotification *)notification
 {
+    @synchronized (self) {
     if ([[notification name] isEqualToString:UIApplicationWillResignActiveNotification]
         || [[notification name] isEqualToString:UIApplicationDidEnterBackgroundNotification]
         || [[notification name] isEqualToString:UIApplicationWillTerminateNotification])
         _appActive = NO;
     else
         _appActive = YES;
+    }
 }
 
 - (void)updateConstraints



More information about the vlc-commits mailing list