call: ретрансмит INVITE каждые 2с + fail-fast при отсутствии маршрута (6с)
This commit is contained in:
1 parent
93becd36e6
commit
0e625da109
8 files changed
+128
-20
No files matched your search
@@ -7,6 +7,7 @@
|
||||
extern "C" {
|
||||
#include "radio/radio_audio.h"
|
||||
#include "../../lib/debug_config.h"
|
||||
#include "../../lib/u_async.h"
|
||||
}
|
||||
|
||||
#include <cstring>
|
||||
@@ -94,6 +95,13 @@ int RadioAudioEngine::initDevice() {
|
||||
}
|
||||
m_deviceStarted = true;
|
||||
m_capturePos = 0;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG,
|
||||
"RadioAudio: device started sr=%u cap='%s' fmt=%d internalSr=%u pb='%s' fmt=%d internalSr=%u",
|
||||
m_device->sampleRate,
|
||||
m_device->capture.name ? m_device->capture.name : "?",
|
||||
(int)m_device->capture.format, m_device->capture.internalSampleRate,
|
||||
m_device->playback.name ? m_device->playback.name : "?",
|
||||
(int)m_device->playback.format, m_device->playback.internalSampleRate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -135,6 +143,31 @@ void RadioAudioEngine::dataCallback(const void* in, void* out, unsigned int fram
|
||||
const int16_t* in16 = (const int16_t*)in;
|
||||
int16_t* out16 = (int16_t*)out;
|
||||
|
||||
/* диагностика (DEBUG_CATEGORY_DEBUG): cadence коллбэка — gap между вызовами (снаружи)
|
||||
* и длительность тела (внутри), чтобы отличить «девайс не дёргает» от «заблокирован внутри». */
|
||||
uint64_t now = get_time_tb();
|
||||
if (m_dbgFrames == 0) {
|
||||
m_dbgFrames = frames;
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "RadioAudio: callback frames=%u in=%s out=%s",
|
||||
frames, in16 ? "yes" : "no", out16 ? "yes" : "no");
|
||||
}
|
||||
m_dbgCbCount++;
|
||||
if (m_dbgPrevCbTb != 0) {
|
||||
uint64_t gap = now - m_dbgPrevCbTb;
|
||||
if (gap > m_dbgGapMax) m_dbgGapMax = gap;
|
||||
}
|
||||
m_dbgPrevCbTb = now;
|
||||
if (m_dbgLastTb == 0) {
|
||||
m_dbgLastTb = now;
|
||||
} else if (now - m_dbgLastTb >= 10000) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "RadioAudio: cb=%u/s frames=%u gapMax=%.1fms bodyMax=%.1fms",
|
||||
m_dbgCbCount, frames, (double)m_dbgGapMax / 10.0, (double)m_dbgBodyMax / 10.0);
|
||||
m_dbgCbCount = 0;
|
||||
m_dbgLastTb = now;
|
||||
m_dbgGapMax = 0;
|
||||
m_dbgBodyMax = 0;
|
||||
}
|
||||
|
||||
/* захват: копим 960 samples → encode+send (сервисный слой). Только когда PTT зажата. */
|
||||
if (in16 && m_talking.load()) {
|
||||
for (unsigned int i = 0; i < frames; i++) {
|
||||
@@ -150,4 +183,8 @@ void RadioAudioEngine::dataCallback(const void* in, void* out, unsigned int fram
|
||||
int n = radio_audio_pull_pcm(m_groupId.load(), out16, (int)frames);
|
||||
if (n < (int)frames)
|
||||
std::memset(out16 + n, 0, (size_t)(frames - n) * sizeof(int16_t));
|
||||
|
||||
uint64_t end = get_time_tb();
|
||||
uint64_t body = end - now;
|
||||
if (body > m_dbgBodyMax) m_dbgBodyMax = body;
|
||||
}
|
||||
Reference in new issue
Block a user