summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2018-11-26 14:10:12 -0500
committerGitHub <noreply@github.com>2018-11-26 14:10:12 -0500
commitf324df3a169160ea73fed098cd94c2c0aea3cd3c (patch)
treec849bbdf1f31aba074de1a8d46080bd5550a0319
parent34e59fdcb1d813fbf32470e8df586b3af0478392 (diff)
parentfc79e7bb7c1401c26cfdd5e6946948968d1166c5 (diff)
downloadsdl_ios-f324df3a169160ea73fed098cd94c2c0aea3cd3c.tar.gz
Merge pull request #1116 from kshala-ford/bugfix/issue_1115_display_link_recreate
DisplayLink issue when app gets (in)active on the phone
-rw-r--r--SmartDeviceLink/SDLStreamingVideoLifecycleManager.m14
1 files changed, 12 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
index e49e658e3..03ed9262c 100644
--- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
+++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
@@ -290,6 +290,13 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
};
}
+- (void)disposeDisplayLink {
+ if (self.displayLink != nil) {
+ [self.displayLink invalidate];
+ self.displayLink = nil;
+ }
+}
+
- (void)didEnterStateVideoStreamStopped {
SDLLogD(@"Video stream stopped");
_videoEncrypted = NO;
@@ -300,8 +307,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
_videoEncoder = nil;
}
- self.displayLink.paused = YES;
- [self.displayLink invalidate];
+ [self disposeDisplayLink];
[[NSNotificationCenter defaultCenter] postNotificationName:SDLVideoStreamDidStopNotification object:nil];
}
@@ -360,6 +366,8 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
[self.videoEncoder stop];
self.videoEncoder = nil;
}
+
+ [self disposeDisplayLink];
if (self.videoEncoder == nil) {
NSError* error = nil;
@@ -410,6 +418,8 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
- (void)didEnterStateVideoStreamSuspended {
SDLLogD(@"Video stream suspended");
+ [self disposeDisplayLink];
+
[[NSNotificationCenter defaultCenter] postNotificationName:SDLVideoStreamSuspendedNotification object:nil];
}