diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2017-02-14 09:24:32 -0800 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2017-02-14 09:24:32 -0800 |
commit | 0043a4bf7a5fcefdafa0dd0f7973933c5bb2cca9 (patch) | |
tree | f1dda0d453ea1f5db1efa2c8ddfd50261b9194d8 | |
parent | 9d783d9cc4e4d5f712ae1772afcfb272ea23c61a (diff) | |
download | sdl_ios-0043a4bf7a5fcefdafa0dd0f7973933c5bb2cca9.tar.gz |
Adding in check for nullable properties of video encoder callback
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaManager.m | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink/SDLStreamingMediaManager.m index d05daa93e..ab7cde8c5 100644 --- a/SmartDeviceLink/SDLStreamingMediaManager.m +++ b/SmartDeviceLink/SDLStreamingMediaManager.m @@ -384,13 +384,17 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark Callbacks -void sdl_videoEncoderOutputCallback(void *outputCallbackRefCon, void *sourceFrameRefCon, OSStatus status, VTEncodeInfoFlags infoFlags, CMSampleBufferRef sampleBuffer) { +void sdl_videoEncoderOutputCallback(void * CM_NULLABLE outputCallbackRefCon, void * CM_NULLABLE sourceFrameRefCon, OSStatus status, VTEncodeInfoFlags infoFlags, CM_NULLABLE CMSampleBufferRef sampleBuffer) { // If there was an error in the encoding, drop the frame if (status != noErr) { [SDLDebugTool logFormat:@"Error encoding video, err=%lld", (int64_t)status]; return; } + if (outputCallbackRefCon == NULL || sourceFrameRefCon == NULL || sampleBuffer == NULL) { + return; + } + SDLStreamingMediaManager *mediaManager = (__bridge SDLStreamingMediaManager *)sourceFrameRefCon; NSData *elementaryStreamData = [mediaManager.class sdl_encodeElementaryStreamWithSampleBuffer:sampleBuffer]; |