individual codec parameters for every call

SF
Stefan Fendt
Wed, Apr 25, 2018 8:04 AM

Hi,

I would like to experiment with some audio-codecs (one of them sitting on an external device --> AMBE-chip). So I wrote a simple pjsua2-based frontend (works) and after that I now try to implement my own variant of a passthrough-codec which should use a callback-function whenever audio-frames need to be encoded into codec-frames and another callback-function for the reverse way.

Obviously this will require me to set these callback-functions (very much preferably on a by call basis) and this is the point where I somewhat got stuck. It seems to me, that there is no way of doing so without patching pjsua2?

If so, could someone please give me a hint for a good starting-point for doing this starting from pj::Call? Can I -- for instance in onCallMediaState (or another callback from within pj::Call) -- just call pjsua_codec_set_param? And if so, how would this be directed/mapped to the codec-instance used for the current call?

Many thanks in advance,
Stefan

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

Hi, I would like to experiment with some audio-codecs (one of them sitting on an external device --> AMBE-chip). So I wrote a simple pjsua2-based frontend (works) and after that I now try to implement my own variant of a passthrough-codec which should use a callback-function whenever audio-frames need to be encoded into codec-frames and another callback-function for the reverse way. Obviously this will require me to set these callback-functions (very much preferably on a by call basis) and this is the point where I somewhat got stuck. It seems to me, that there is no way of doing so without patching pjsua2? If so, could someone please give me a hint for a good starting-point for doing this starting from pj::Call? Can I -- for instance in onCallMediaState (or another callback from within pj::Call) -- just call pjsua_codec_set_param? And if so, how would this be directed/mapped to the codec-instance used for the current call? Many thanks in advance, Stefan -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
SF
simone.freddio@voippartners.it
Wed, Apr 25, 2018 8:17 AM

You have to implement your own media transport adapter.
I have used it to mangle rtp packet in one of my projects. You can use it to completely rewrote rtp packet.

https://trac.pjsip.org/repos/wiki/Media_Transport_Adapter

Inviato dal mio dispositivo Huawei

-------- Messaggio originale --------
Oggetto: [pjsip] individual codec parameters for every call
Da: Stefan Fendt
A: pjsip@lists.pjsip.org
CC:

Hi,

I would like to experiment with some audio-codecs (one of them sitting on an external device --> AMBE-chip). So I wrote a simple pjsua2-based frontend (works) and after that I now try to implement my own variant of a passthrough-codec which should use a callback-function whenever audio-frames need to be encoded into codec-frames and another callback-function for the reverse way.

Obviously this will require me to set these callback-functions (very much preferably on a by call basis) and this is the point where I somewhat got stuck. It seems to me, that there is no way of doing so without patching pjsua2?

If so, could someone please give me a hint for a good starting-point for doing this starting from pj::Call? Can I -- for instance in onCallMediaState (or another callback from within pj::Call) -- just call pjsua_codec_set_param? And if so, how would this be directed/mapped to the codec-instance used for the current call?

Many thanks in advance,
Stefan

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

SF
Stefan Fendt
Wed, Apr 25, 2018 2:44 PM

You have to implement your own media transport adapter. 

I have used it to mangle rtp packet in one of my projects. You can use it to completely rewrote rtp packet.

Which is not what I want to do. Actually I do not want to mess with the network-stream but with the audio and/or audio-quality of different audio-codecs.

As far as I understand this wiki-article the MediaTransportAdapter sits right in between Media and MediaTransport. So it could see codec-frames but not audio-frames. For what I want to do it is essential that I can see both. This was the main reason, why I thought it would be a good idea to just  implement a passthrough-codec.

Maybe I didn't explain too well, what I want to do, so I'll try to detail it a little bit more:

I have some external audio-codecs. That is not inside pjsip/pjsua. Some are software-based and I could integrate them into pjsip, some are hardware-based -- yes, some neat multi-legged black silicone-bug sitting on a PCB outside of the PC. All these codecs require callbacks for setting parameters and for doing the actual samples<-->codecframes translation, "somewhere(tm)" inside of pjsua/pjsip.

I am looking for the most effective, least obscure way of integrating an external audio-codec into pjsip/pjsua while keeping it external (I need to for the PCB-codecs for obvious reasons) and being able to tweak it's parameters during an active call.

all the best,
Stefan

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

>You have to implement your own media transport adapter.  I have used it to mangle rtp packet in one of my projects. You can use it to completely rewrote rtp packet. Which is not what I want to do. Actually I do not want to mess with the network-stream but with the audio and/or audio-quality of different audio-codecs. >https://trac.pjsip.org/repos/wiki/Media_Transport_Adapter As far as I understand this wiki-article the MediaTransportAdapter sits right in between Media and MediaTransport. So it could see codec-frames but not audio-frames. For what I want to do it is essential that I can see both. This was the main reason, why I thought it would be a good idea to just implement a passthrough-codec. Maybe I didn't explain too well, what I want to do, so I'll try to detail it a little bit more: I have some external audio-codecs. That is not inside pjsip/pjsua. Some are software-based and I could integrate them into pjsip, some are hardware-based -- yes, some neat multi-legged black silicone-bug sitting on a PCB outside of the PC. All these codecs require callbacks for setting parameters and for doing the actual samples<-->codecframes translation, "somewhere(tm)" inside of pjsua/pjsip. I am looking for the most effective, least obscure way of integrating an external audio-codec into pjsip/pjsua while keeping it external (I need to for the PCB-codecs for obvious reasons) and being able to tweak it's parameters during an active call. all the best, Stefan -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
SF
simone.freddio@voippartners.it
Wed, Apr 25, 2018 4:41 PM

Have you see here: http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__CODEC.htm
There is a section named "register new codec"...

Inviato dal mio dispositivo Huawei

-------- Messaggio originale --------
Oggetto: Re: [pjsip] Ris: individual codec parameters for every call
Da: Stefan Fendt
A: pjsip list
CC:

>You have to implement your own media transport adapter.
I have used it to mangle rtp packet in one of my projects. You can use it to completely rewrote rtp packet.

Which is not what I want to do. Actually I do not want to mess with the network-stream but with the audio and/or audio-quality of different audio-codecs.

>https://trac.pjsip.org/repos/wiki/Media_Transport_Adapter

As far as I understand this wiki-article the MediaTransportAdapter sits right in between Media and MediaTransport. So it could see codec-frames but not audio-frames. For what I want to do it is essential that I can see both. This was the main reason, why I thought it would be a good idea to just implement a passthrough-codec.

Maybe I didn't explain too well, what I want to do, so I'll try to detail it a little bit more:

I have some external audio-codecs. That is not inside pjsip/pjsua. Some are software-based and I could integrate them into pjsip, some are hardware-based -- yes, some neat multi-legged black silicone-bug sitting on a PCB outside of the PC. All these codecs require callbacks for setting parameters and for doing the actual samplescodecframes translation, "somewhere(tm)" inside of pjsua/pjsip.

I am looking for the most effective, least obscure way of integrating an external audio-codec into pjsip/pjsua while keeping it external (I need to for the PCB-codecs for obvious reasons) and being able to tweak it's parameters during an active call.

all the best,
Stefan

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

AE
Alexey Ermoshin
Wed, Apr 25, 2018 6:11 PM

Stefan,

I think the best way to integrate custom codec into PJSIP is to make all
things as the library do it itself: implement your own codec factory with
all of its callback, than register it in pjmedia and that's all - all the
other things is the PJSIP's magic :)
The simpliest example is G.711 codec implementation (or L16 may be the
easiest also).
Before making the outgoing call (or while initing yor app) you should
change priority of codec so your one has the highest priority.


Алексей Ермошин

2018-04-25 17:44 GMT+03:00 Stefan Fendt stefan@sfendt.de:

You have to implement your own media transport adapter.

I have used it to mangle rtp packet in one of my projects. You can use it
to completely rewrote rtp packet.

Which is not what I want to do. Actually I do not want to mess with the
network-stream but with the audio and/or audio-quality of different
audio-codecs.

As far as I understand this wiki-article the MediaTransportAdapter sits
right in between Media and MediaTransport. So it could see codec-frames but
not audio-frames. For what I want to do it is essential that I can see
both. This was the main reason, why I thought it would be a good idea to
just  implement a passthrough-codec.

Maybe I didn't explain too well, what I want to do, so I'll try to detail
it a little bit more:

I have some external audio-codecs. That is not inside pjsip/pjsua. Some
are software-based and I could integrate them into pjsip, some are
hardware-based -- yes, some neat multi-legged black silicone-bug sitting on
a PCB outside of the PC. All these codecs require callbacks for setting
parameters and for doing the actual samples<-->codecframes translation,
"somewhere(tm)" inside of pjsua/pjsip.

I am looking for the most effective, least obscure way of integrating an
external audio-codec into pjsip/pjsua while keeping it external (I need to
for the PCB-codecs for obvious reasons) and being able to tweak it's
parameters during an active call.

all the best,
Stefan

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Stefan, I think the best way to integrate custom codec into PJSIP is to make all things as the library do it itself: implement your own codec factory with all of its callback, than register it in pjmedia and that's all - all the other things is the PJSIP's magic :) The simpliest example is G.711 codec implementation (or L16 may be the easiest also). Before making the outgoing call (or while initing yor app) you should change priority of codec so your one has the highest priority. --- Алексей Ермошин 2018-04-25 17:44 GMT+03:00 Stefan Fendt <stefan@sfendt.de>: > >You have to implement your own media transport adapter. > I have used it to mangle rtp packet in one of my projects. You can use it > to completely rewrote rtp packet. > > Which is not what I want to do. Actually I do not want to mess with the > network-stream but with the audio and/or audio-quality of different > audio-codecs. > > >https://trac.pjsip.org/repos/wiki/Media_Transport_Adapter > > As far as I understand this wiki-article the MediaTransportAdapter sits > right in between Media and MediaTransport. So it could see codec-frames but > not audio-frames. For what I want to do it is essential that I can see > both. This was the main reason, why I thought it would be a good idea to > just implement a passthrough-codec. > > Maybe I didn't explain too well, what I want to do, so I'll try to detail > it a little bit more: > > I have some external audio-codecs. That is not inside pjsip/pjsua. Some > are software-based and I could integrate them into pjsip, some are > hardware-based -- yes, some neat multi-legged black silicone-bug sitting on > a PCB outside of the PC. All these codecs require callbacks for setting > parameters and for doing the actual samples<-->codecframes translation, > "somewhere(tm)" inside of pjsua/pjsip. > > I am looking for the most effective, least obscure way of integrating an > external audio-codec into pjsip/pjsua while keeping it external (I need to > for the PCB-codecs for obvious reasons) and being able to tweak it's > parameters during an active call. > > all the best, > Stefan > -- > Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet. > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >
SF
Stefan Fendt
Wed, Apr 25, 2018 9:20 PM

Hi Alexey,

This already works. As mentioned before I already have a working passthrough-codec. The only remaining problem is to set parameters for it on a by-call basis. Currently all parameters are hard-coded which is not to ideal for experimentation.

All the best,
Stefan

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

Hi Alexey, This already works. As mentioned before I already have a working passthrough-codec. The only remaining problem is to set parameters for it on a by-call basis. Currently all parameters are hard-coded which is not to ideal for experimentation. All the best, Stefan -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
AE
Alexey Ermoshin
Thu, Apr 26, 2018 4:32 AM

Stefan,

I think you should add some API to your codec factory. This API will give
you access to codec settings. While the factory creates codecs, it can
store pointer to it and access codecs settings.


Алексей Ермошин

2018-04-26 0:20 GMT+03:00 Stefan Fendt stefan@sfendt.de:

Hi Alexey,

This already works. As mentioned before I already have a working
passthrough-codec. The only remaining problem is to set parameters for it
on a by-call basis. Currently all parameters are hard-coded which is not to
ideal for experimentation.

All the best,

Stefan

Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Stefan, I think you should add some API to your codec factory. This API will give you access to codec settings. While the factory creates codecs, it can store pointer to it and access codecs settings. --- Алексей Ермошин 2018-04-26 0:20 GMT+03:00 Stefan Fendt <stefan@sfendt.de>: > Hi Alexey, > > This already works. As mentioned before I already have a working > passthrough-codec. The only remaining problem is to set parameters for it > on a by-call basis. Currently all parameters are hard-coded which is not to > ideal for experimentation. > > All the best, > > Stefan > -- > Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet. > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >