You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.7 KiB
38 lines
1.7 KiB
// call_headless.h — headless-аудио-сокет для P2P-звонков (PCM, без тактирования) |
|
// |
|
// Отдельный TCP-сокет, через который headless-клиент (CLI/скрипт) обменивается |
|
// ГОТОВЫМ PCM с ядром звонка. Ядро кодирует PCM→Opus (TX) и декодирует Opus→PCM |
|
// (RX); тактирование и джиттер — на стороне клиента. Сигналинг идёт по |
|
// control-сокету (chat_headless_control), аудио — по этому сокету. |
|
// |
|
// Бинарный фрейм (обе стороны): |
|
// [type:1][call_id:8][len:2][data:len] |
|
// type = 0x01 HELLO (клиент → ядро: привязать соединение к call_id, data пусто) |
|
// type = 0x02 FRAME (PCM int16 mono 48k, 960 сэмплов = 1920 байт) |
|
// клиент → ядро = PCM захвата (кодируется и шлётся пиру); |
|
// ядро → клиент = PCM воспроизведения (декодированный Opus пира) |
|
#ifndef CALL_HEADLESS_H |
|
#define CALL_HEADLESS_H |
|
|
|
#include <stdint.h> |
|
|
|
struct UASYNC; |
|
struct UTUN_INSTANCE; |
|
|
|
#define CALL_AUDIO_HELLO 0x01 |
|
#define CALL_AUDIO_FRAME 0x02 |
|
#define CALL_AUDIO_HDR_SIZE 11 /* type(1) + call_id(8) + len(2) */ |
|
#define CALL_AUDIO_PCM_FRAME_BYTES (960 * (int)sizeof(int16_t)) /* 1920 — PCM int16 mono 48k 20мс */ |
|
|
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
|
int call_headless_init(struct UASYNC* ua, struct UTUN_INSTANCE* inst, |
|
const char* bind_ip, int port); |
|
void call_headless_destroy(struct UTUN_INSTANCE* inst); |
|
|
|
#ifdef __cplusplus |
|
} |
|
#endif |
|
#endif /* CALL_HEADLESS_H */
|
|
|