[vlc-commits] ios: fix application crash due permitted opengl calls in background ( fixes #8139)

Gleb Pinigin git at videolan.org
Sat Mar 23 17:42:14 CET 2013


vlc | branch: master | Gleb Pinigin <gpinigin at gmail.com> | Sat Mar 23 10:31:39 2013 +0000| [25fe96d2476a2911b4175bc76f9ed08f08f104a4] | committer: Felix Paul Kühne

ios: fix application crash due permitted opengl calls in background (fixes #8139)

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

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

diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index b513911..05defcd 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -232,14 +232,17 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned requested_count)
 static void PictureRender(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
 {
     vout_display_sys_t *sys = vd->sys;
-
-    vout_display_opengl_Prepare( sys->vgl, pic, subpicture );
+    if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
+        vout_display_opengl_Prepare( sys->vgl, pic, subpicture );
+    }
 }
 
 static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
 {
     vout_display_sys_t *sys = vd->sys;
-    vout_display_opengl_Display(sys->vgl, &vd->fmt );
+    if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
+        vout_display_opengl_Display(sys->vgl, &vd->fmt );
+    }
     picture_Release (pic);
     sys->has_first_frame = true;
     (void)subpicture;
@@ -297,7 +300,10 @@ static void OpenglSwap(vlc_gl_t *gl)
 {
     vout_display_sys_t *sys = gl->sys;
     EAGLContext *context = [sys->glView context];
-    [context presentRenderbuffer:GL_RENDERBUFFER];
+
+    if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) {
+        [context presentRenderbuffer:GL_RENDERBUFFER];
+    }
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list