13
0

Fix peak-thread race on session-load

Session dirs must exist when loading Sources of a project.
SourceFactory::init() starts the PeakFileBuilder background thread
early on when libardour is initialized.
This thread [re-]creates missing peak files when Sources are
created or loaded. However AudioSource::prepare_for_peakfile_writes
assumes the peak/ folder exists. This may not be true, which lead to
"AudioSource: cannot open _peakpath [..] (No such file or directory)"
errors.

Also drop creation from Source::get_transients_path() as this
may be called concurrently from Analyser background threads.
This commit is contained in:
Robin Gareus 2022-08-12 01:31:49 +02:00
parent 69d3bd8821
commit 839400f438
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 2 additions and 6 deletions

View File

@ -424,6 +424,8 @@ Session::Session (AudioEngine &eng,
destroy ();
throw SessionException (_("Failed to load state"));
}
ensure_subdirs (); // archived or zipped sessions may lack peaks/ analysis/ etc
}
/* apply the loaded state_tree */
@ -509,8 +511,6 @@ Session::Session (AudioEngine &eng,
_engine.set_session (this);
_engine.reset_timebase ();
ensure_subdirs (); // archived or zipped sessions may lack peaks/ analysis/ etc
if (!mix_template.empty ()) {
/* ::create() unsets _is_new after creating the session.
* But for templated sessions, the sample-rate is initially unset

View File

@ -368,10 +368,6 @@ Source::get_transients_path () const
vector<string> parts;
string s;
/* old sessions may not have the analysis directory */
_session.ensure_subdirs ();
s = _session.analysis_dir ();
parts.push_back (s);