Protect SoundTouch lookahead when catching up live stream audio
This commit is contained in:
1 parent
5d9da0c6b1
commit
fcb0768052
3 files changed
+4
-1
No files matched your search
+2
-1
@@ -864,7 +864,8 @@ Android:
|
||||
GAP создаёт новый input/origin, сохраняя общее устройство и часы остальных трансляций.
|
||||
Watchdog 2s проверяет отсутствие движения hardware head только при достаточном заполнении либо заблокированной записи;
|
||||
намеренная пауза и ожидание данных до порога запуска не считаются зависанием. Ошибка содержит состояние и счётчики устройства.
|
||||
Защитный guard аудиоконтроллера — максимум 40ms и audio device lead + 20ms.
|
||||
Защитный guard аудиоконтроллера — максимум 40ms и audio device lead + 20ms, плюс
|
||||
внутренний lookahead SoundTouch (SETTING_INITIAL_LATENCY при текущем темпе).
|
||||
Наблюдённое опережение decoder остаётся диагностикой и не увеличивает задержку звука.
|
||||
Отсутствие output progress 10s при наличии работы даёт ERROR; сетевые паузы и ожидание PTS допустимы.
|
||||
Состояния ожидания KEY и decoder разделены; логи показывают inputs/decoded/shown, рабочие slots, inflight и decoderLeadUs.
|
||||
|
||||
@@ -201,6 +201,7 @@ JNIEXPORT jlongArray JNICALL Java_com_utun_chat_data_NativeLib_nativeStreamPlayb
|
||||
if (proposed > p->position) p->position = proposed;
|
||||
}
|
||||
p->time_us = now;
|
||||
if (p->audio) guard += stream_playback_audio_latency_us(p->audio);
|
||||
if (stream_playback_clock_update(&p->clock, now, p->position, ready, guard, pending, starved, &p->state) < 0) return NULL;
|
||||
jlong values[] = {p->position, p->state.reserve_us, p->state.minimum_us, p->state.tempo_milli, p->state.waiting,
|
||||
p->audio ? stream_playback_audio_needs_input(p->audio) : 0,
|
||||
|
||||
@@ -335,6 +335,7 @@ void StreamPlayerWindow::decode() {
|
||||
bool starved = p.underruns != observedGaps; observedGaps = p.underruns;
|
||||
if (!p.activeAudio && p.position + (now - p.clockAt) * p.adaptation.tempo_milli / 1000 > p.ready) starved = true;
|
||||
int64_t guardUs = p.activeAudio ? std::max<int64_t>(40000, p.deviceLead + 20000) : p.framePeriod;
|
||||
if (p.sound) guardUs += stream_playback_audio_latency_us(p.sound);
|
||||
int64_t pending = p.sound ? stream_playback_audio_pending_gain(p.sound, played) : 0;
|
||||
if (stream_playback_clock_update(&p.adaptation, now, std::max(p.position, position), p.ready,
|
||||
guardUs, pending, !p.ended && starved, &p.timing) < 0) p.resync = true;
|
||||
|
||||
Reference in new issue
Block a user