G.729 使用single channel, 16bit 的sample,8000 sample per second 的PCM格式作爲輸入源, 即:
waveformat.wFormatTag = WAVE_FORMAT_PCM;
waveformat.nChannels = 1;
waveformat.nSamplesPerSec = 8000;
waveformat.wBitsPerSample = 16;
waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec*(waveformat.wBitsPerSample/8);
waveformat.nBlockAlign = waveformat.nChannels * (waveformat.wBitsPerSample/8);
waveformat.cbSize = 0;
G.729 is a frame based encoding 10ms/frame, 16:1 compress rate,就是形成一個frame的數據需要10ms的sample.對於上述PCM格式來說,音頻驅動會產生 8000 samples * (16 bit/s / 8 bit/bytes) = 16000 byte/s 就是說 一秒鐘內音頻驅動產生16000 bytes, 就是一毫秒產生16個字節
於是作爲G.729的輸入源的數據大小應該爲 160byte的倍數, 就是說產生一個G.729的frame (這個frame 10 byte)需要輸入160 byte的數據。
含有G.729的RTP包中payload根據RFC3551應該是2個frame,就是默認傳輸G.729的每個RTP包中有20Bytes=2frame的淨負載