Clarify frame assembly and keep reference PCM arithmetic signed

This commit is contained in:
evgeny committed 2026-10-26 15:58:11 +01:00
1 parent 7c4e6f9972
commit 0ad80f3906
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -118,6 +118,7 @@ static void ca_send_raw(struct call_audio_client* cli, const uint8_t* data, size
}
}
/* Собрать header+PCM до обращения к очереди, чтобы overflow не оставил часть фрейма. */
static void ca_write_frame(struct call_audio_client* cli, uint8_t type, uint64_t call_id,
const uint8_t* data, uint16_t len) {
if (len > CA_PCM_FRAME_BYTES || (len && !data)) {
+1 -1
View File
@@ -82,7 +82,7 @@ static void fixture_start(struct queue_fixture* f) {
/* Reference decoder видит и отброшенные кадры: его Opus-состояние совпадает с принимающим. */
static void emit_frame(struct queue_fixture* f, int retained) {
int16_t pcm[CA_FRAME_SAMPLES], decoded[CA_FRAME_SAMPLES];
for (int i = 0; i < CA_FRAME_SAMPLES; ++i) pcm[i] = (int16_t)((f->sequence * 73 + i * 31) % 6000 - 3000);
for (int i = 0; i < CA_FRAME_SAMPLES; ++i) pcm[i] = (int16_t)(((int)f->sequence * 73 + i * 31) % 6000 - 3000);
++f->sequence;
uint8_t opus[256];
int len = opus_codec_encode(f->encoder, pcm, CA_FRAME_SAMPLES, opus, sizeof(opus)); CHECK(len > 0);