From 1089101e7761a7e277531a55268fab7fc75a7ae0 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Tue, 18 Oct 2022 19:28:29 +0100 Subject: [PATCH] drop log messages with not supported encoding on apple platforms, fixes #596 --- apple/src/FFmpegKitConfig.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apple/src/FFmpegKitConfig.m b/apple/src/FFmpegKitConfig.m index 4d0b7cd..73de6ab 100644 --- a/apple/src/FFmpegKitConfig.m +++ b/apple/src/FFmpegKitConfig.m @@ -487,7 +487,12 @@ void ffmpegkit_statistics_callback_function(int frameNumber, float fps, float qu void process_log(long sessionId, int levelValue, AVBPrint* logMessage) { int activeLogLevel = av_log_get_level(); - Log* log = [[Log alloc] init:sessionId:levelValue:[NSString stringWithCString:logMessage->str encoding:NSUTF8StringEncoding]]; + NSString* message = [NSString stringWithCString:logMessage->str encoding:NSUTF8StringEncoding]; + if (message == nil) { + // WE DROP LOGS THAT WE CANNOT DISPLAY + return; + } + Log* log = [[Log alloc] init:sessionId:levelValue:message]; BOOL globalCallbackDefined = false; BOOL sessionCallbackDefined = false; LogRedirectionStrategy activeLogRedirectionStrategy = globalLogRedirectionStrategy;