summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-09-21 16:28:28 -0400
committerJoel Fischer <joeljfischer@gmail.com>2017-09-21 16:28:28 -0400
commit2f8ecfa476b9d52598bc0e753a5ba29cb6fcb74f (patch)
tree61c386b28011d07053c29a5101296ffdf93697dd
parente951565e5ea18ae84644648bea29d6e1fbaa4258 (diff)
downloadsdl_ios-bugfix/issue_717_custom_framerate_encoding_without_custom_timestamp.tar.gz
Make the backgrounding frames use the custom framerate if necessarybugfix/issue_717_custom_framerate_encoding_without_custom_timestamp
-rw-r--r--SmartDeviceLink/SDLStreamingMediaLifecycleManager.m11
1 files changed, 8 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m
index 6b5baa9db..ecbbf88d8 100644
--- a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m
+++ b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m
@@ -58,7 +58,7 @@ SDLAudioStreamState *const SDLAudioStreamStateStarting = @"AudioStreamStarting";
SDLAudioStreamState *const SDLAudioStreamStateReady = @"AudioStreamReady";
SDLAudioStreamState *const SDLAudioStreamStateShuttingDown = @"AudioStreamShuttingDown";
-static NSUInteger const SDLFramesToSendOnBackground = 30;
+static NSUInteger const FramesToSendOnBackground = 30;
typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_Nullable capability);
@@ -670,8 +670,13 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
return;
}
- const CMTime interval = CMTimeMake(1, 30);
- for (int frameCount = 0; frameCount < SDLFramesToSendOnBackground; frameCount++) {
+ int32_t timeRate = 30;
+ if (self.videoEncoderSettings[(__bridge NSString *)kVTCompressionPropertyKey_ExpectedFrameRate] != nil) {
+ timeRate = ((NSNumber *)self.videoEncoderSettings[(__bridge NSString *)kVTCompressionPropertyKey_ExpectedFrameRate]).intValue;
+ }
+
+ const CMTime interval = CMTimeMake(1, timeRate);
+ for (int frameCount = 0; frameCount < FramesToSendOnBackground; frameCount++) {
if (CMTIME_IS_VALID(self.lastPresentationTimestamp)) {
self.lastPresentationTimestamp = CMTimeAdd(self.lastPresentationTimestamp, interval);
[self.videoEncoder encodeFrame:self.backgroundingPixelBuffer presentationTimestamp:self.lastPresentationTimestamp];