From b4b52abbd46132b8f684589707ec90e0b0e64c2e Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Mon, 13 Jul 2026 18:05:02 +0800 Subject: [PATCH] Remove noisy graph-snapshot logs and add waveform-sync diagnostics - Strip the dense RenderWorkerPool debug messages about cached/stale graph snapshots and cleanup to reduce log spam. - Add qDebug logging and status-bar feedback to TimelineWidget::SynchronizeSelectedClipsByWaveform() so we can see why the sync action does nothing (e.g. not enough cached clips or no usable offset). --- app/render/renderworkerpool.cpp | 10 ------- app/widget/timelinewidget/timelinewidget.cpp | 31 +++++++++++++++++--- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/app/render/renderworkerpool.cpp b/app/render/renderworkerpool.cpp index 958e59058..d537b3d79 100644 --- a/app/render/renderworkerpool.cpp +++ b/app/render/renderworkerpool.cpp @@ -579,14 +579,8 @@ bool RenderWorkerPool::PrepareJob(RenderTicketPtr ticket, if (it != graph_cache_.end() && !project->is_modified()) { graph_path = it->path; AddGraphPathRefLocked(graph_path); - qDebug() - << "RenderWorkerPool::PrepareJob: using cached graph snapshot" - << graph_path; } else { if (it != graph_cache_.end()) { - qDebug() - << "RenderWorkerPool::PrepareJob: graph stale, rewriting" - << project->is_modified(); SetGraphPathCachedLocked(it->path, false); graph_cache_.erase(it); } @@ -648,9 +642,6 @@ bool RenderWorkerPool::WriteGraphSnapshot(Project *project, QString *path) return false; } - qDebug() << "RenderWorkerPool wrote graph snapshot" << file.fileName() - << "size" << QFileInfo(file.fileName()).size(); - *path = file.fileName(); return true; } @@ -1242,7 +1233,6 @@ void RenderWorkerPool::FinishWithFrame(RenderTicketPtr ticket, void RenderWorkerPool::CleanupGraphFile(const QString &path) { if (!path.isEmpty()) { - qDebug() << "RenderWorkerPool cleaning up graph file" << path; QFile::remove(path); } } diff --git a/app/widget/timelinewidget/timelinewidget.cpp b/app/widget/timelinewidget/timelinewidget.cpp index d110dc0a9..0226267f0 100644 --- a/app/widget/timelinewidget/timelinewidget.cpp +++ b/app/widget/timelinewidget/timelinewidget.cpp @@ -1029,7 +1029,11 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform() const QVector sync_clips = GetSelectedWaveformSyncClips(GetSelectedBlocks()); + qDebug() << "TimelineWidget::SynchronizeSelectedClipsByWaveform:" + << sync_clips.size() << "sync clip(s) selected"; if (sync_clips.size() < 2) { + Core::instance()->ShowStatusBarMessage( + tr("Select at least 2 clips with cached waveforms to sync by waveform")); return; } @@ -1050,6 +1054,11 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform() const QVector reference_envelope = ExtractWaveformCacheEnvelope(reference, sample_rate, window_samples); + qDebug() << "TimelineWidget::SynchronizeSelectedClipsByWaveform: sample_rate=" + << sample_rate << "window_samples=" << window_samples + << "max_offset_windows=" << max_offset_windows + << "reference_envelope_size=" << reference_envelope.size(); + struct SyncPlacement { ClipBlock *clip = nullptr; rational timeline_in; @@ -1066,9 +1075,14 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform() sync_clip, sample_rate, window_samples); const AudioWaveformSync::OffsetResult offset = AudioWaveformSync::EstimateEnvelopeOffset(reference_envelope, - candidate_envelope, - window_samples, - max_offset_windows); + candidate_envelope, + window_samples, + max_offset_windows); + qDebug() << "TimelineWidget::SynchronizeSelectedClipsByWaveform: candidate" + << sync_clip.clip << "envelope_size=" + << candidate_envelope.size() << "offset_valid=" + << offset.valid << "offset_samples=" << offset.offset_samples + << "confidence=" << offset.confidence; if (!offset.valid) { continue; } @@ -1076,12 +1090,19 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform() const AudioSynchronizer::Placement placement = AudioSynchronizer::PlaceByWaveformOffset( reference.clip->in(), offset.offset_samples, sample_rate); + qDebug() << "TimelineWidget::SynchronizeSelectedClipsByWaveform: placement" + << "valid=" << placement.valid << "timeline_in=" + << placement.timeline_in.toDouble(); if (placement.valid && placement.timeline_in >= 0) { placements.append({ sync_clip.clip, placement.timeline_in }); } } if (placements.size() < 2) { + qDebug() << "TimelineWidget::SynchronizeSelectedClipsByWaveform: no usable" + << "offsets found"; + Core::instance()->ShowStatusBarMessage( + tr("Could not find a usable waveform offset for the selected clips")); return; } @@ -1107,7 +1128,9 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform() new SetSelectionsCommand(this, new_selections, GetSelections())); Core::instance()->undo_stack()->push(command, - tr("Synchronize Clips by Waveform")); + tr("Synchronize Clips by Waveform")); + Core::instance()->ShowStatusBarMessage( + tr("Synchronized %1 clip(s) by waveform").arg(placements.size())); } void TimelineWidget::GenerateProxiesForSelectedClips()