13
0

Handle NoPeakFile flag

Previously the flag was not honored. AudioSource::write() calls
-> SndFileSource::write_unlocked()
-> SndFileSource::nondestructive_write_unlocked() which calls
-> AudioSource::compute_and_write_peaks

This produced "cannot open _peakpath" messages during
session-archive FLAC encoding. Likewise closing an audio file
calls touch_peakfile(). Although this simply failed silently.
This commit is contained in:
Robin Gareus 2022-11-20 00:00:32 +01:00
parent 05b8df6da9
commit 16e0de95fc
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -192,6 +192,10 @@ AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, ScopedConnect
void
AudioSource::touch_peakfile ()
{
if (_flags & NoPeakFile) {
return;
}
GStatBuf statbuf;
if (g_stat (_peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) {
@ -849,7 +853,7 @@ AudioSource::close_peakfile ()
int
AudioSource::prepare_for_peakfile_writes ()
{
if (_session.deletion_in_progress() || _session.peaks_cleanup_in_progres()) {
if (_session.deletion_in_progress() || _session.peaks_cleanup_in_progres() || 0 != (_flags & NoPeakFile)) {
return -1;
}