Add a debug option to investigate RegionFX related underruns

This commit is contained in:
Robin Gareus 2024-08-27 17:50:10 +02:00
parent 981dfd67e7
commit 8fd081679d
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
5 changed files with 18 additions and 0 deletions

View file

@ -34,6 +34,7 @@ namespace PBD {
namespace DEBUG {
LIBARDOUR_API extern DebugBits AudioEngine;
LIBARDOUR_API extern DebugBits AudioPlayback;
LIBARDOUR_API extern DebugBits AudioCacheRefill;
LIBARDOUR_API extern DebugBits AudioUnitConfig;
LIBARDOUR_API extern DebugBits AudioUnitGUI;
LIBARDOUR_API extern DebugBits AudioUnitProcess;

View file

@ -178,6 +178,13 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, ti
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("Playlist %1 read @ %2 for %3, channel %4, regions %5 mixdown @ %6 gain @ %7\n",
name(), start.samples(), cnt.samples(), chan_n, regions.size(), mixdown_buffer, gain_buffer));
DEBUG_TRACE (DEBUG::AudioCacheRefill, string_compose ("Playlist '%1' chn: %2 from %3 to %4 [s] PH@ %5\n",
name (), chan_n,
std::setprecision (3), std::fixed,
start.samples() / (float)_session.sample_rate (),
(start.samples() + cnt.samples()) / (float)_session.sample_rate (),
_session.transport_sample () / (float)_session.sample_rate ()));
samplecnt_t const scnt (cnt.samples ());
/* optimizing this memset() away involves a lot of conditionals

View file

@ -610,6 +610,11 @@ AudioRegion::read_at (Sample* buf,
The caller has verified that we cover the desired section.
*/
DEBUG_TRACE (DEBUG::AudioCacheRefill, string_compose ("- Region '%1' chn: %2 from %3 to %4 [s]\n",
name(), chan_n,
std::setprecision (3), std::fixed,
pos / (float)_session.sample_rate (), (pos + cnt) / (float)_session.sample_rate ()));
/* See doc/region_read.svg for a drawing which might help to explain
what is going on.
*/

View file

@ -29,6 +29,7 @@ using namespace std;
PBD::DebugBits PBD::DEBUG::AudioEngine = PBD::new_debug_bit ("AudioEngine");
PBD::DebugBits PBD::DEBUG::AudioPlayback = PBD::new_debug_bit ("audioplayback");
PBD::DebugBits PBD::DEBUG::AudioCacheRefill = PBD::new_debug_bit ("audiocacherefill");
PBD::DebugBits PBD::DEBUG::AudioUnitConfig = PBD::new_debug_bit ("AudioUnitConfig");
PBD::DebugBits PBD::DEBUG::AudioUnitGUI = PBD::new_debug_bit ("AudioUnitGUI");
PBD::DebugBits PBD::DEBUG::AudioUnitProcess = PBD::new_debug_bit ("AudioUnitProcess");

View file

@ -423,6 +423,10 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
cerr << "underrun for " << _name << " Available samples: " << available << " required: " << disk_samples_to_consume << endl;
#endif
DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 underrun in %2, total space = %3 vs %4\n", DEBUG_THREAD_SELF, name (), available, disk_samples_to_consume));
DEBUG_TRACE (DEBUG::AudioCacheRefill, string_compose ("DR '%1' underrun have %2 need %3 samples at pos %4\n",
name (), available, disk_samples_to_consume,
std::setprecision (3), std::fixed,
start_sample / (float)_session.sample_rate ()));
Underrun ();
return;
}