chore: improve debug logging of audio lag from stretcher
This commit is contained in:
@@ -362,11 +362,18 @@ void MusicProvider::onAudioReady(float *data, int32_t frames) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(frames > buf_size_samples) {
|
if(frames > buf_size_samples) {
|
||||||
LOGE("MusicProvider::onAudioReady() asked for frames=%d but buf_size=%d", frames, buf_size_samples);
|
LOGE("audio buffer too small! adapt PlaybackEngine::buf_size_samples!! asked for frames=%d but buf_size=%d", frames, buf_size_samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. read from oboe into our temp de-interleaved buffer 'buf'
|
// 1. read from oboe into our temp de-interleaved buffer 'buf'
|
||||||
size_t num_frames = std::min((size_t) frames, buf_size_samples);
|
size_t num_frames_requested = std::min((size_t) frames, buf_size_samples);
|
||||||
|
size_t num_frames_available = stretcher->available();
|
||||||
|
if(num_frames_available < num_frames_requested) {
|
||||||
|
// this is an audio glitch
|
||||||
|
// TODO: bubble info upwards, in a counter (so we can collect device-specific glitch stats)
|
||||||
|
LOGI("stretcher lag: %d requested, %d available", num_frames_requested, num_frames_available);
|
||||||
|
}
|
||||||
|
size_t num_frames = std::min(num_frames_available, num_frames_requested);
|
||||||
stretcher->retrieve(buf_ptr, num_frames);
|
stretcher->retrieve(buf_ptr, num_frames);
|
||||||
|
|
||||||
// 2. convert to add samples to interleaved *data
|
// 2. convert to add samples to interleaved *data
|
||||||
|
|||||||
Reference in New Issue
Block a user