From 9566a368154818a1ef5650fd3decc8cf808cbdfd Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 22 Dec 2021 16:22:05 -0800 Subject: [PATCH] Error handler: Better handle errors and increase silence generator to 10 seconds at a time --- Audio/Chain/BufferChain.m | 4 ++-- Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Audio/Chain/BufferChain.m b/Audio/Chain/BufferChain.m index b0dba6de0..478d14adb 100644 --- a/Audio/Chain/BufferChain.m +++ b/Audio/Chain/BufferChain.m @@ -51,10 +51,10 @@ id source = [AudioSource audioSourceForURL:url]; DLog(@"Opening: %@", url); - if (![source open:url]) + if (!source || ![source open:url]) { DLog(@"Couldn't open source..."); - url = [NSURL URLWithString:@"silence://1"]; + url = [NSURL URLWithString:@"silence://10"]; source = [AudioSource audioSourceForURL:url]; if (![source open:url]) return NO; diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m index 91fdde348..991f8bcda 100755 --- a/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m @@ -23,7 +23,10 @@ enum { channels = 2 }; NSString * path = [[[s url] relativeString] substringFromIndex:10]; - length = [path intValue] * sample_rate; + int seconds = [path intValue]; + if (!seconds) seconds = 10; + + length = seconds * sample_rate; remain = length; [self willChangeValueForKey:@"properties"];