Get AAC sampleRate/channels setting from H.245 terminalCapabilitySet


I’m new to H323, so if there something went wrong, please let me know it. I’ll be very apprieciated.

The information in H.245 terminalCapabilitySet is really sucked. As a newbie, I have no idea what it is whatever represented in the collapsing & nonCollapsing.

After double checked with some documents & code, I finally got the meanings:
Get AAC sampleRate from H.245 terminalCapabilitySet
Look into the picture1(AAC format of this picture is AAC LC):

Item 0 –> nonCollapsing item –> parameterIdentifier: standard = 0
this means AAC ProfileAndLevel

Item 1 –> nonCollapsing item –> parameterIdentifier: standard = 1
this means AAC Format

Item 2 –> nonCollapsing item –> parameterIdentifier: standard = 3
this means AAC AudioObjectType

Item 3 –> nonCollapsing item –> parameterIdentifier: standard = 4
this means AAC Sample rate

And the sample rate byte value stored in a two bytes array which are: 0x12, 0x88

Explain it in a suedo-code will be:

[cpp]u8 abyConfig[] = {0x12,0x88};[/cpp]

If the audio codec format is AAC LC then

// aac-lc(2)(bit:5) + sampling(bit:4) + chnl(bit:4) + resv(bit:3)
u8 bySampleFeq = ((abyConfig[0]&0x07)<<1) | ((abyConfig[1]&0x80)>>7);
u8 byChnl = ((abyConfig[1]&0x78)>>3);

If the audio codec format is AAC LD then

bySampleFeq = (abyConfig[2]&0x0f);
byChnl = (abyConfig[3]&0xf0)>>4;

 

As you know AAC format in this example stand as AAC LC, so we’ll use formula 1:

((abyConfig[0]&0x07)<<1) | ((abyConfig[1]&0x80)>>7) = ((0x12 & 0x7) << 1) | ((0x88 & 0x80) >> 7) = 6;

then check it with the mapping listed bellow, you will get the sample rate of the terminal capability set is emFs24000, which means this terminal supports 24000KHz AAC LC audio.

    enum emAACSampleFreq                    //sampling frequency
    {
        emFs96000 = 0,
        emFs88200 = 1,
        emFs64000 = 2,
        emFs48000 = 3,
        emFs44100 = 4,
        emFs32000 = 5,
        emFs24000 = 6,
        emFs22050 = 7,
        emFs16000 = 8,
        emFs12000 = 9,
        emFs11025 = 10,
        emFs8000  = 11
    };
    
    enum emAACChnlCfg                       //channel config
    {
        emChnlCust   = 0,
        emChnl1      = 1,                   //单声道
        emChnl2      = 2,                   //双声道
        emChnl3      = 3,					//单、双都支持
        emChnl4      = 4,
        emChnl5      = 5,
        emChnl5dot1  = 6,                   //5.1声道
        emChnl7dot1  = 7                    //7.1声道
    };

 

Leave a comment

Your email address will not be published. Required fields are marked *