From 766a5bf688378128ce12911d9cc3ca6d20823407 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sat, 21 May 2022 17:26:54 -0700 Subject: [PATCH 1/2] audiovisualwaveform: skip null copy length --- app/audio/audiovisualwaveform.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/audio/audiovisualwaveform.cpp b/app/audio/audiovisualwaveform.cpp index 03bd6aabc..0fb9c215a 100644 --- a/app/audio/audiovisualwaveform.cpp +++ b/app/audio/audiovisualwaveform.cpp @@ -152,6 +152,9 @@ void AudioVisualWaveform::OverwriteSums(const AudioVisualWaveform &sums, const r int copy_len = their_arr.size() - their_start_index; if (!length.isNull()) { copy_len = qMin(copy_len, time_to_samples(length, rate_dbl)); + if (copy_len == 0) { + continue; + } } // Determine end index of our array From 3de9251cf59cf41b12a82a0c6036e377f05df41b Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sat, 21 May 2022 18:34:41 -0700 Subject: [PATCH 2/2] viewer: limit invalidation range --- app/node/output/viewer/viewer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/node/output/viewer/viewer.cpp b/app/node/output/viewer/viewer.cpp index 34629c4f7..34103e887 100644 --- a/app/node/output/viewer/viewer.cpp +++ b/app/node/output/viewer/viewer.cpp @@ -227,9 +227,11 @@ void ViewerOutput::InvalidateCache(const TimeRange& range, const QString& from, // TEMP: Just to restore the intended functionality for now. This will be removed later. if (from == kTextureInput) { - video_frame_cache()->Invalidate(range); + TimeRange r = range.Intersected(TimeRange(0, GetVideoLength())); + if (r.length() != 0) video_frame_cache()->Invalidate(r); } else if (from == kSamplesInput) { - audio_playback_cache()->Invalidate(range); + TimeRange r = range.Intersected(TimeRange(0, GetAudioLength())); + if (r.length() != 0) audio_playback_cache()->Invalidate(r); } }