summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuboš Doležel <lubos@dolezel.info>2020-03-29 23:07:35 +0200
committerGitHub <noreply@github.com>2020-03-29 23:07:35 +0200
commitaaa3593b1e1f1c43ccb62028071842e376341c5e (patch)
tree822e5d67aad0c22cd24894ed65ba0cfd06537204 /src
parent8767538e965849dd9c4b9693007fdf05a886aa5c (diff)
parent859b4233e53be71f88e54c8505dc0052e0059742 (diff)
downloadtwinkle-aaa3593b1e1f1c43ccb62028071842e376341c5e.tar
twinkle-aaa3593b1e1f1c43ccb62028071842e376341c5e.tar.gz
twinkle-aaa3593b1e1f1c43ccb62028071842e376341c5e.tar.lz
twinkle-aaa3593b1e1f1c43ccb62028071842e376341c5e.tar.xz
twinkle-aaa3593b1e1f1c43ccb62028071842e376341c5e.zip
Merge pull request #152 from fbriere/issue/104-bcg729-api
Add support for the new bcg729 API, introduced in version 1.0.2
Diffstat (limited to 'src')
-rw-r--r--src/audio/audio_decoder.cpp8
-rw-r--r--src/audio/audio_encoder.cpp10
2 files changed, 18 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;
}
diff --git a/src/audio/audio_encoder.cpp b/src/audio/audio_encoder.cpp
index d6ff356..952b1ee 100644
--- a/src/audio/audio_encoder.cpp
+++ b/src/audio/audio_encoder.cpp
@@ -433,7 +433,11 @@ uint16 t_g726_audio_encoder::encode(int16 *sample_buf, uint16 nsamples,
t_g729a_audio_encoder::t_g729a_audio_encoder(uint16 payload_id, uint16 ptime, t_user *user_config)
: t_audio_encoder(payload_id, ptime, user_config)
{
+#ifdef HAVE_BCG729_ANNEX_B
+ _context = initBcg729EncoderChannel(false);
+#else
_context = initBcg729EncoderChannel();
+#endif
}
t_g729a_audio_encoder::~t_g729a_audio_encoder()
@@ -451,7 +455,13 @@ uint16 t_g729a_audio_encoder::encode(int16 *sample_buf, uint16 nsamples,
for (uint16 done = 0; done < nsamples; done += 80)
{
+#ifdef HAVE_BCG729_ANNEX_B
+ uint8 frame_size = 10;
+ bcg729Encoder(_context, &sample_buf[done], &payload[done / 8], &frame_size);
+ assert(frame_size == 10);
+#else
bcg729Encoder(_context, &sample_buf[done], &payload[done / 8]);
+#endif
}
return nsamples / 8;