Audio Backchannel codec selection

Selection of the codec to be used for the Audio Backchannel stream is done in a different way than all the other stream types. The ONVIF device does not have a current audio backchannel codec configuration and only lists all the supported ones using GetAudioDecoderConfigurationOptions. There is no SetAudioDecodecConfiguration in the ONVIF Specifications as there is for Audio In – SetAudioEncoderConfiguration. The selection of the codec is done in the RTSP. This is done by having multiple rtpmap for the Audio Backchannel track.

Section ”5.3.2 Connection setup for a bi- directional connection” of the ONVIF Streaming Specification states:

” The server shall list all supported decoding codecs as own media section and the client

chooses which one is used. The payload type and the encoded bitstream shall be matched

with one of the a=rtpmap fields provided by the server so that the server can properly

determine the audio decoder.”

Section ”5.3.2.3” of the ONVIF Streaming Specification gives an example of SDP with multple Audio Backchannel codecs supported:

v=0

o= 2890842807 IN IP4 192.168.0.1

s=RTSP Session with audiobackchannel

m=video 0 RTP/AVP 26

a=control:rtsp://192.168.0.1/video

a=recvonly

m=audio 0 RTP/AVP 0

a=control:rtsp://192.168.0.1/audio

a=recvonly

m=audio 0 RTP/AVP 0 97 98 99 100

a=control:rtsp://192.168.0.1/audioback

a=rtpmap:0 PCMU/8000

a=rtpmap:97 G726-16/8000

a=rtpmap:98 G726-24/8000

a=rtpmap:99 G726-32/8000

a=rtpmap:100 G726-40/8000

a=sendonly

Based on this SDP the ONVIF driver will select the needed codec, encode the audio stream, and send the RTP audio packets with the payload type of the codec. For example, if the user has selected “G726, 32kbps, 8kHz”, the ONVIF driver will encode the audio using the G.726 codec in 32 kbps and set the payload type of the RTP packets sent to 99.

Unfortunately, a lot of ONVIF devices do not follow this convention and will list in the SDP only one codec for the Audio Backchannel track. This usually is also the codec of the Audio In track. In these cases, the ONVIF driver will ignore the user’s selection and will use the codec stated in the SDP. Also, if for some reason the codec selected by the user does not exist in the codec list in the SDP, then the ONVIF Driver will select the first supported audio codec.