From 36bbd14113e25038aa490d11c7c010fcaae324a0 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 27 Jan 2015 23:13:29 +0100 Subject: [PATCH] towards fixing #5711 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t call ::output() [here: SilenceTrimmer::process()] with no data to process. If (position + N * period-size) % chunksize == 0; frames_left == 0 before the last call to ::output(). chunker.h:60 keeps the ProcessContext::EndOfInput flag and the SilenceTrimmer will already have done ‘in_end’ processing. --- libs/audiographer/audiographer/general/chunker.h | 2 +- libs/audiographer/audiographer/general/silence_trimmer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/audiographer/audiographer/general/chunker.h b/libs/audiographer/audiographer/general/chunker.h index 0ee0c20b20..d61c68dee4 100644 --- a/libs/audiographer/audiographer/general/chunker.h +++ b/libs/audiographer/audiographer/general/chunker.h @@ -67,7 +67,7 @@ class /*LIBAUDIOGRAPHER_API*/ Chunker position += frames_left; } - if (context.has_flag (ProcessContext::EndOfInput)) { + if (context.has_flag (ProcessContext::EndOfInput) && position > 0) { ProcessContext c_out (context, buffer, position); ListedSource::output (c_out); } diff --git a/libs/audiographer/audiographer/general/silence_trimmer.h b/libs/audiographer/audiographer/general/silence_trimmer.h index c0d6d73c4b..a715feb0c8 100644 --- a/libs/audiographer/audiographer/general/silence_trimmer.h +++ b/libs/audiographer/audiographer/general/silence_trimmer.h @@ -128,7 +128,7 @@ class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer check_flags (*this, c); if (throw_level (ThrowStrict) && in_end) { - throw Exception(*this, "process() after reacing end of input"); + throw Exception(*this, "process() after reaching end of input"); } in_end = c.has_flag (ProcessContext::EndOfInput);