Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for bcg729 1.0.2+ #104

Closed
urobasa opened this issue Feb 5, 2018 · 11 comments · Fixed by #152
Closed

Add support for bcg729 1.0.2+ #104

urobasa opened this issue Feb 5, 2018 · 11 comments · Fixed by #152
Assignees
Labels
bug pending A pull request closing this issue has been submitted

Comments

@urobasa
Copy link

urobasa commented Feb 5, 2018

cmake .. -DWITH_ALSA=On -DWITH_SPEEX=On -DWITH_ILBC=Off -DWITH_ZRTP=Off -DWITH_G729=On -DWITH_QT5=On

/home/admins/twinkle/src/audio/audio_decoder.cpp: In member function ‘virtual uint16 t_g729a_audio_decoder::decode(uint8*, uint16, int16*, uint16)’:
/home/admins/twinkle/src/audio/audio_decoder.cpp:550:50: error: invalid conversion from ‘int16* {aka short int*}’ to ‘uint8_t {aka unsigned char}’ [-fpermissive]
bcg729Decoder(_context, &payload[done], false, &pcm_buf[done * 8]);
^~~~~~~~~~~~~~~~~~
/home/admins/twinkle/src/audio/audio_decoder.cpp:550:68: error: too few arguments to function ‘void bcg729Decoder(bcg729DecoderChannelContextStruct*, uint8_t*, uint8_t, uint8_t, uint8_t, uint8_t, int16_t*)’
bcg729Decoder(_context, &payload[done], false, &pcm_buf[done * 8]);
^
In file included from /home/admins/twinkle/src/audio/audio_decoder.h:42:0,
from /home/admins/twinkle/src/audio/audio_decoder.cpp:20:
/usr/include/bcg729/decoder.h:68:24: note: declared here
BCG729_VISIBILITY void bcg729Decoder(bcg729DecoderChannelContextStruct decoderChannelContext, uint8_t bitStream[], uint8_t bitStreamLength, uint8_t frameErasureFlag, uint8_t SIDFrameFlag, uint8_t rfc3389PayloadFlag, int16_t signal[]);
^~~~~~~~~~~~~
/home/admins/twinkle/src/audio/audio_decoder.cpp: In member function ‘virtual uint16 t_g729a_audio_decoder::conceal(int16
, uint16)’:
/home/admins/twinkle/src/audio/audio_decoder.cpp:565:48: error: invalid conversion from ‘int16* {aka short int*}’ to ‘uint8_t {aka unsigned char}’ [-fpermissive]
bcg729Decoder(_context, nullptr, true, pcm_buf);
^
/home/admins/twinkle/src/audio/audio_decoder.cpp:565:48: error: too few arguments to function ‘void bcg729Decoder(bcg729DecoderChannelContextStruct*, uint8_t*, uint8_t, uint8_t, uint8_t, uint8_t, int16_t*)’
In file included from /home/admins/twinkle/src/audio/audio_decoder.h:42:0,
from /home/admins/twinkle/src/audio/audio_decoder.cpp:20:
/usr/include/bcg729/decoder.h:68:24: note: declared here
BCG729_VISIBILITY void bcg729Decoder(bcg729DecoderChannelContextStruct *decoderChannelContext, uint8_t bitStream[], uint8_t bitStreamLength, uint8_t frameErasureFlag, uint8_t SIDFrameFlag, uint8_t rfc3389PayloadFlag, int16_t signal[]);
^~~~~~~~~~~~~
src/audio/CMakeFiles/libtwinkle-audio.dir/build.make:86: ошибка выполнения рецепта для цели «src/audio/CMakeFiles/libtwinkle-audio.dir/audio_decoder.cpp.o»
make[2]: *** [src/audio/CMakeFiles/libtwinkle-audio.dir/audio_decoder.cpp.o] Ошибка 1
CMakeFiles/Makefile2:233: ошибка выполнения рецепта для цели «src/audio/CMakeFiles/libtwinkle-audio.dir/all»
make[1]: *** [src/audio/CMakeFiles/libtwinkle-audio.dir/all] Ошибка 2
Makefile:129: ошибка выполнения рецепта для цели «all»

@fbriere
Copy link
Collaborator

fbriere commented Feb 6, 2018

It would appear that the bcg729 API was changed in version 1.0.2 (specifically by commits BelledonneCommunications/bcg729@843c130 and BelledonneCommunications/bcg729@948d32a).

Until Twinkle supports the new API, you should probably downgrade to 1.0.1, which seems to compile just fine.

@fbriere
Copy link
Collaborator

fbriere commented Feb 7, 2018

I have confirmed that everything compiles with bcg729 1.0.2 after adding the new arguments to initBcg729EncoderChannel(), bcg729Encoder() and bcg729Decoder(). But since I have no idea what the actual values should be, someone else will have to step in to finish the job. 😄

If it is desirable to support both APIs, I have written a CMake test (42ec560) that does just that. If someone can provide me with the appropriate values, I'll gladly submit a PR.

@fbriere fbriere changed the title Error build on Ubuntu 17.10 witch bcg729 Add support for bcg729 1.0.2+ Feb 7, 2018
@mkubecek
Copy link
Collaborator

mkubecek commented Feb 7, 2018

Incompatible API change in a point release? Sigh...

I'm afraid allowing build against both version will be necessary - for some time, at least.

fbriere added a commit to fbriere/twinkle that referenced this issue Feb 10, 2018
(The master build is currently commented out due to LubosD#104; it can be
enabled after that issue is fixed.)
tonich-sh pushed a commit to tonich-sh/twinkle that referenced this issue Mar 29, 2019
(The master build is currently commented out due to LubosD#104; it can be
enabled after that issue is fixed.)
@fbriere fbriere added the bug label Jul 3, 2019
@fbriere fbriere self-assigned this Jul 4, 2019
fbriere added a commit to fbriere/twinkle that referenced this issue Jul 7, 2019
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 LubosD#104
@fbriere fbriere added the pending A pull request closing this issue has been submitted label Jul 7, 2019
@fbriere
Copy link
Collaborator

fbriere commented Jul 7, 2019

I have just submitted PR #152 to fix this issue.

Full disclosure: this code is untested. Of course, it compiles, and the CMake test to find which version is installed is working fine, but I couldn't test the part actually calling bcg729 functions. Now, the changes are so minimal to make any bug very unlikely. Still, if other users could give it i try just to confirm it works just fine, that would be appreciated. Thanks!

@fbriere
Copy link
Collaborator

fbriere commented Jul 7, 2019

@urobasa @DAC324 If you ever get an opportunity to test this fix, that would be most welcome!

fbriere added a commit to fbriere/twinkle that referenced this issue Jul 7, 2019
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 LubosD#104
fbriere added a commit to fbriere/twinkle that referenced this issue Jul 7, 2019
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 LubosD#104
@fbriere
Copy link
Collaborator

fbriere commented Sep 7, 2019

Incompatible API change in a point release? Sigh...

Even better, they did not bother changing the SONAME, even though both versions's ABI are incompatible. Mixing them results in muted sound at best, and segfaults at worst.

@fbriere
Copy link
Collaborator

fbriere commented Sep 8, 2019

I've now had a chance to actually test G.729, and this seems to work fine. (Any confirmation would always be welcome, of course.)

@DAC324
Copy link

DAC324 commented Sep 9, 2019 via email

@fbriere
Copy link
Collaborator

fbriere commented Dec 8, 2019

@DAC324 Unless this only occurs with #152 and not with the master branch, please open a separate issue for these unrelated problems. Thanks.

@DAC324
Copy link

DAC324 commented Dec 9, 2019

I've now had a chance to actually test G.729, and this seems to work fine. (Any confirmation would always be welcome, of course.)

Unfortunately, the code still has not been fixed to compile with any G.729 version newer than 1.0.1.
I investigated a bit further in the meantime.

Even when being compiled with -DWITH_G729=Off, I still get that crackling - it does not seem to be dependent on G.729 as Twinkle chooses G.726 40 kbps for my test connection.
When disabling this codec in the user profile, the crackling disappears.

So it looks like the problem is with the G.726 40 kbps codec installed in the system, and not G.729.

By the way: Compiling from the (hopefully) master branch, I get the following version information:
Twinkle 1.10.2 - 14 February 2018

Am I doing something wrong, and is there a newer Twinkle branch already available?

@fbriere
Copy link
Collaborator

fbriere commented Dec 9, 2019

@DAC324 As I previously said, please open a separate issue for this unrelated problem. Thanks.

fbriere added a commit to fbriere/twinkle that referenced this issue Mar 29, 2020
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 LubosD#104
fbriere added a commit to fbriere/twinkle that referenced this issue Feb 19, 2022
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 LubosD#104

(cherry picked from commit 46bee14)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pending A pull request closing this issue has been submitted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants