From bfe92c5b4fbc2bb263636098d45b41e3d4e38c6f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 24 Nov 2015 18:58:11 +0100 Subject: prevent concurrent peak-file init. When embedding external files. the same file is queued twice for peak-file generation. Since there are two peak_thread_work threas in SourceFactory, this can lead to inconsistent/missing peaks. TODO: fix the actual cause, duplicate call to setup_peakfile(): #0 ARDOUR::SourceFactory::setup_peakfile (s=..., async=true) at ../libs/ardour/source_factory.cc:116 #1 0x00007ffff6c2552f in ARDOUR::SourceFactory::createExternal (type=..., s=..., path="/tmp/CB_bass_Track08.wav", chn=0, flags=(unknown: 0), announce=true, defer_peaks=true) at ../libs/ardour/source_factory.cc:254 #2 0x0000000000886f50 in Editor::embed_sndfiles (this=0x3810340, paths=std::vector of length 1, capacity 1 = {...}, multifile=false, check_sample_rate=@0x7fffffffc2df: true, disposition=Editing::ImportDistinctFiles, mode=Editing::ImportAsTrack, pos=@0x7fffffffc458: -1, target_regions=1, target_tracks=-1, track=..., instrument=...) at ../gtk2_ardour/editor_audio_import.cc:630 #3 0x0000000000885c7c in Editor::do_embed (this=0x3810340, paths=std::vector of length 1, capacity 1 = {...}, import_as=Editing::ImportDistinctFiles, mode=Editing::ImportAsTrack, pos=@0x7fffffffc458: -1, instrument=...) at ../gtk2_ardour/editor_audio_import.cc:414 #4 0x0000000000e93aeb in SoundFileOmega::do_something (this=0x490f530, action=-5) at ../gtk2_ardour/sfdb_ui.cc:1983 #0 ARDOUR::SourceFactory::setup_peakfile (s=..., async=true) at ../libs/ardour/source_factory.cc:116 #1 0x0000000000888954 in Editor::add_sources (this=0x3810340, paths=std::vector of length 1, capacity 1 = {...}, sources=std::vector of length 1, capacity 1 = {...}, pos=@0x7fffffffc458: 0, disposition=Editing::ImportDistinctFiles, mode=Editing::ImportAsTrack, target_regions=1, target_tracks=-1, track=..., instrument=...) at ../gtk2_ardour/editor_audio_import.cc:883 #2 0x0000000000887131 in Editor::embed_sndfiles (this=0x3810340, paths=std::vector of length 1, capacity 1 = {...}, multifile=false, check_sample_rate=@0x7fffffffc2df: true, disposition=Editing::ImportDistinctFiles, mode=Editing::ImportAsTrack, pos=@0x7fffffffc458: 0, target_regions=1, target_tracks=-1, track=..., instrument=...) at ../gtk2_ardour/editor_audio_import.cc:653 #3 0x0000000000885c7c in Editor::do_embed (this=0x3810340, paths=std::vector of length 1, capacity 1 = {...}, import_as=Editing::ImportDistinctFiles, mode=Editing::ImportAsTrack, pos=@0x7fffffffc458: 0, instrument=...) at ../gtk2_ardour/editor_audio_import.cc:414 #4 0x0000000000e93aeb in SoundFileOmega::do_something (this=0x490f530, action=-5) at ../gtk2_ardour/sfdb_ui.cc:1983 --- libs/ardour/audiosource.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'libs/ardour/audiosource.cc') diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index e7d81feaec..9d90d05cb1 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -238,6 +238,7 @@ AudioSource::rename_peakfile (string newpath) int AudioSource::initialize_peakfile (const string& audio_path, const bool in_session) { + Glib::Threads::Mutex::Lock lm (_initialize_peaks_lock); GStatBuf statbuf; _peakpath = construct_peak_filepath (audio_path, in_session); -- cgit v1.2.3