[Asterisk-Dev] changing codec during call - part 2

Steve Kann stevek at stevek.com
Wed Mar 2 09:02:18 MST 2005


Jesse Kaijen wrote:

>After some nice digging in the iaxclient-code and the libiax2-code I found a
>way to change the codec during a call. 
>Iax2 handles is very nice when a client changes the code, because a full
>frame is send and in the session the svoiceformat is changed.
>Also when a full frame is received with a different codec then before, in
>the session the voiceformat is changed.
>
>
>But there are a few problems that I encountered: 
>Codec_out: codec that I send
>Codec_in: codec that I receive
>
>I can change Codec_out now in iaxclient: 
>       calls[0].format=Codec_out (not nice but good for testing)
>       a new encoder is created and IAX2 sends a full-frame
>
>The Codec_in is changed in IAX.session.voiceformat but the change isn't
>given to the client. This can be solved if the iaxclient fully understands
>IAX.session as in iax.c. Then if decoder_format!=session.voiceformat 
>I make new decoder with session.voiceformat
>
>My question is why is the iaxclient kept dumb about the session? Or is that
>just laziness?
>  
>
That was the design of libiax2; the "session" was intended to be opaque.



>An other problem I have is that the frames in the jitterbuffer wich are
>Codec_in_old are tried to be decoded with codec_in_new. My question to Steve
>is: is it possible to put besides the frames also the codec of that frame in
>the jitterbuffer? So I won't hear a crack in the audio.
>  
>
Isn't that already the case: i.e. we put the iax_event "e" into the 
jitterbuffer, e->subclass is the format when e->etype == IAX_EVENT_VOICE..

>If somebody wants to test the codec switch method or has some questions
>please contact me in the #asterisk-dev name:Jackthe
>  
>
I still think that it would be more effective to just change the length 
of the frames, but I guess that's harder to implement since it's hard to 
tell for ABR codecs like speex..

-SteveK




More information about the asterisk-dev mailing list