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).
This commit is contained in:
2026-07-13 18:05:02 +08:00
parent 7cde0b0f1a
commit b4b52abbd4
2 changed files with 27 additions and 14 deletions
-10
View File
@@ -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);
}
}
@@ -1029,7 +1029,11 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform()
const QVector<WaveformSyncClip> 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<double> 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;
@@ -1069,6 +1078,11 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform()
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;
}
@@ -1108,6 +1129,8 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform()
Core::instance()->undo_stack()->push(command,
tr("Synchronize Clips by Waveform"));
Core::instance()->ShowStatusBarMessage(
tr("Synchronized %1 clip(s) by waveform").arg(placements.size()));
}
void TimelineWidget::GenerateProxiesForSelectedClips()