Fix do not initialize OpenGL if VideoView is creating with the app in background

Bug: webrtc:8498
Change-Id: I354caf9c2b4dc9e596e97cd9a80dac71b6c89289
Reviewed-on: https://webrtc-review.googlesource.com/20980
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20611}
diff --git a/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m b/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
index 80282f0..53f5270 100644
--- a/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
+++ b/sdk/objc/Framework/Classes/UI/RTCEAGLVideoView.m
@@ -183,7 +183,9 @@
       RTCEAGLVideoView *strongSelf = weakSelf;
       [strongSelf displayLinkTimerDidFire];
     }];
-  [self setupGL];
+  if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive) {
+    [self setupGL];
+  }
   return YES;
 }