summaryrefslogtreecommitdiffstats
path: root/src/audio/audio_decoder.cpp
diff options
context:
space:
mode:
authorFrédéric Brière <fbriere@fbriere.net>2019-07-06 15:40:56 -0400
committerFrédéric Brière <fbriere@fbriere.net>2020-03-29 11:49:04 -0400
commit46bee14d3cc49d4fb49eaf36a29dbcc7a11a5ab7 (patch)
tree795578907f6da6d66b7421beed198d30f385e0dc /src/audio/audio_decoder.cpp
parent8767538e965849dd9c4b9693007fdf05a886aa5c (diff)
downloadtwinkle-46bee14d3cc49d4fb49eaf36a29dbcc7a11a5ab7.tar
twinkle-46bee14d3cc49d4fb49eaf36a29dbcc7a11a5ab7.tar.gz
twinkle-46bee14d3cc49d4fb49eaf36a29dbcc7a11a5ab7.tar.lz
twinkle-46bee14d3cc49d4fb49eaf36a29dbcc7a11a5ab7.tar.xz
twinkle-46bee14d3cc49d4fb49eaf36a29dbcc7a11a5ab7.zip
Add support for the new bcg729 API, introduced in version 1.0.2
Starting with version 1.0.2, bcg729 has changed its API to add support for G.729B, thus requiring us to adjust our function calls depending on which version is installed. When dealing with the new API, we merely need to add a few parameters to disable all G.729B features, namely: * On the decoder side: When `SIDFrameFlag` is not set, the decoder will behave just like before, decoding the payload as a standard G.729A voice frame (or concealing an erased frame). The other parameters, `rfc3389PayloadFlag` and `bitStreamLength`, are only of use when dealing with a SID frame sent as per RFC 3389, and are ignored if `SIDFrameFlag` is not set. * On the encoder side: When `enableVAD` is disabled, the encoder will behave just like before, producing only standard G.729A voice frames. The only API difference is the introduction of `*bitStreamLength`, to return the length of the encoded frame (0, 2 or 10 bytes). In our case, this will always be 10 bytes just like before; an assert() was added to guarantee this. Closes #104
Diffstat (limited to 'src/audio/audio_decoder.cpp')
-rw-r--r--src/audio/audio_decoder.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/audio/audio_decoder.cpp b/src/audio/audio_decoder.cpp
index 65935dd..c661910 100644
--- a/src/audio/audio_decoder.cpp
+++ b/src/audio/audio_decoder.cpp
@@ -547,7 +547,11 @@ uint16 t_g729a_audio_decoder::decode(uint8 *payload, uint16 payload_size,
for (uint16 done = 0; done < payload_size; done += 10)
{
+#ifdef HAVE_BCG729_ANNEX_B
+ bcg729Decoder(_context, &payload[done], 0, false, false, false, &pcm_buf[done * 8]);
+#else
bcg729Decoder(_context, &payload[done], false, &pcm_buf[done * 8]);
+#endif
}
return payload_size * 8;
@@ -562,7 +566,11 @@ uint16 t_g729a_audio_decoder::conceal(int16 *pcm_buf, uint16 pcm_buf_size)
{
assert(pcm_buf_size >= 80);
+#ifdef HAVE_BCG729_ANNEX_B
+ bcg729Decoder(_context, nullptr, 0, true, false, false, pcm_buf);
+#else
bcg729Decoder(_context, nullptr, true, pcm_buf);
+#endif
return 80;
}