diff --git a/src/call/call_headless.c b/src/call/call_headless.c index 1dbb4994..a2c76673 100644 --- a/src/call/call_headless.c +++ b/src/call/call_headless.c @@ -198,8 +198,9 @@ static void ca_parse_frames(struct call_audio_client* cli) { CH_ID, flen, CA_PCM_FRAME_BYTES); } else { opus_codec_encoder_t* enc = ca_encoder(ca, call_id); + int16_t pcm[CA_FRAME_SAMPLES]; memcpy(pcm, data, sizeof(pcm)); // wire header 11 байт не выровнен для int16_t uint8_t opus[256]; - int olen = enc ? opus_codec_encode(enc, (const int16_t*)data, CA_FRAME_SAMPLES, opus, (int)sizeof(opus)) : -1; + int olen = enc ? opus_codec_encode(enc, pcm, CA_FRAME_SAMPLES, opus, (int)sizeof(opus)) : -1; if (olen <= 0) { ca->c_enc_dropped++; DEBUG_WARN(DEBUG_CATEGORY_CALL, "%s: encode failed (olen=%d) call_id=%016llx", diff --git a/src/radio/radio_headless.c b/src/radio/radio_headless.c index 9231b35d..a978467f 100644 --- a/src/radio/radio_headless.c +++ b/src/radio/radio_headless.c @@ -336,8 +336,9 @@ static void rh_parse_frames(struct radio_headless_client* cli) { RH_ID, flen, RH_PCM_FRAME_BYTES); } else { opus_codec_encoder_t* enc = rh_encoder(rh, group_id); + int16_t pcm[RH_FRAME_SAMPLES]; memcpy(pcm, data, sizeof(pcm)); // wire header 11 байт не выровнен для int16_t uint8_t opus[256]; - int olen = enc ? opus_codec_encode(enc, (const int16_t*)data, RH_FRAME_SAMPLES, opus, (int)sizeof(opus)) : -1; + int olen = enc ? opus_codec_encode(enc, pcm, RH_FRAME_SAMPLES, opus, (int)sizeof(opus)) : -1; if (olen <= 0) { rh->c_enc_dropped++; DEBUG_WARN(DEBUG_CATEGORY_RADIO, "%s: encode failed (olen=%d) group=0x%016llx",