summaryrefslogtreecommitdiffstats
path: root/src/codec
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-07-20 13:58:52 +0200
committerHarald Welte <laforge@gnumonks.org>2018-07-21 07:40:20 +0000
commit9bb966afb0be5cd439bae141875e94bd3bb97761 (patch)
treef1c83529e3c8430dafa3f46a538d35fe2ea340e6 /src/codec
parentab383e6d27bac1c2627640e7b3aa4f96428fcf5b (diff)
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
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/ecu_fr.c16
1 files changed, 6 insertions, 10 deletions
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;
}