From 9bb966afb0be5cd439bae141875e94bd3bb97761 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 20 Jul 2018 13:58:52 +0200 Subject: libosmocodec: FR err concealment: Fix too many silent frames generated As stated in its own documentation, reduce_xmaxcr_all() should only return true when ALL XMAXC fields return true. However, previous implementation returned true when at least one of them returned true. As a result, if any of the sections is silent (for instance because one of the bursts was lost), the whole frame is silenced, returning a zeroed buffer. Related: OS#2700 Fixes: 40def49ac4b8babbd1b17c232137ce50a428706b ("libosmocodec: implement ECU (Error Concealment Unit) for FR") Change-Id: I1624b7c6574f53d0593a61645d4fdc5d56cabe96 --- src/codec/ecu_fr.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/codec/ecu_fr.c b/src/codec/ecu_fr.c index d4ea741b..784a5b8e 100644 --- a/src/codec/ecu_fr.c +++ b/src/codec/ecu_fr.c @@ -64,16 +64,12 @@ static bool reduce_xmaxcr(struct bitvec *frame_bitvec, */ static bool reduce_xmaxcr_all(struct bitvec *frame_bitvec) { - bool silent = false; - - if (reduce_xmaxcr(frame_bitvec, GSM610_RTP_XMAXC00)) - silent = true; - if (reduce_xmaxcr(frame_bitvec, GSM610_RTP_XMAXC10)) - silent = true; - if (reduce_xmaxcr(frame_bitvec, GSM610_RTP_XMAXC20)) - silent = true; - if (reduce_xmaxcr(frame_bitvec, GSM610_RTP_XMAXC30)) - silent = true; + bool silent = true; + + silent &= reduce_xmaxcr(frame_bitvec, GSM610_RTP_XMAXC00); + silent &= reduce_xmaxcr(frame_bitvec, GSM610_RTP_XMAXC10); + silent &= reduce_xmaxcr(frame_bitvec, GSM610_RTP_XMAXC20); + silent &= reduce_xmaxcr(frame_bitvec, GSM610_RTP_XMAXC30); return silent; } -- cgit v1.2.3