[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:51:04 CEST 2015


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

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

(cherry picked from commit 8d765e169785861bc63fc3234f5d4d16ca4c9940)

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

 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 306cdb5..06e9a9f 100644
--- a/modules/video_output/ios2.m
+++ b/modules/video_output/ios2.m
@@ -334,8 +334,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);
 
@@ -410,7 +412,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;
 }
@@ -491,7 +495,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;
@@ -526,12 +530,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