]> git.ipfire.org Git - thirdparty/asterisk.git/commit
audiohook.c: Improve frame pairing logic to avoid MixMonitor breakage with mixed...
authorMichal Hajek <michal.hajek@daktela.com>
Wed, 21 May 2025 08:28:20 +0000 (10:28 +0200)
committerBen Ford <bford@sangoma.com>
Thu, 3 Jul 2025 16:15:32 +0000 (11:15 -0500)
commit7107de7d78a3a323e73cfdd6a8989afaeebba65c
tree8f5700a3936cbd5c6e35e2832767c48b282ccae8
parent07c99aacbd85ac5933e866ab92f1c339be7f6cd0
audiohook.c: Improve frame pairing logic to avoid MixMonitor breakage with mixed codecs

This patch adjusts the read/write synchronization logic in audiohook_read_frame_both()
to better handle calls where participants use different codecs or sample sizes
(e.g., alaw vs G.722). The previous hard threshold of 2 * samples caused MixMonitor
recordings to break or stutter when frames were not aligned between both directions.

The new logic uses a more tolerant limit (1.5 * samples), which prevents audio tearing
without causing excessive buffer overruns. This fix specifically addresses issues
with MixMonitor when recording directly on a channel in a bridge using mixed codecs.

Reported-by: Michal Hajek <michal.hajek@daktela.com>
Resolves: #1276
Resolves: #1279
main/audiohook.c