// get the default mic
var mic:Microphone = Microphone.getMicrophone();
// best quality (picks up all sounds, no transmission interruptions)
// Using SPEEX codec with quality of 5
mic.codec = SoundCodec.SPEEX;
mic.encodeQuality = 5; // Required bit rate: 16.8 kbits/s,
// Rate is automatically set to 16K Hz if SPEEX codec is set
//mic.rate = 16;
mic.framesPerPacket = 1;
// Attach the mic to the NetStream
I guess I figured out myself.
In Adobe's documentation for Microphone.codec property:
Speex includes voice activity detection (VAD) and automatically reduces bandwidth when no voice is detected. When using the Speex codec, Adobe recommends that you set the silence level to 0. To set the silence level, use the
That's means it's possible that the size of a frame might be different when VAD is deteced (and bandwidth is reduced), even framesPerPacket is set to 1 and encodeQuality is set to 5. I tried decoding the 10-byte frame, and I found 79 bits (which is 9 bytes and 7 bits) are used for this special frame.
I also observed that this 10-byte frame is always 10 byte frame even the encodeQuality is set to 0 or 10.
Hope it helps.
the speex codec embedded in Flash Player, uses VAD (Voice Activity Detection) and CBR (Constant Bit-Rate), so when no voice activity is detected, the codec send a few bytes with constant rate, for padding the stream and report that there is no voice. I guess the ten bytes is this padding report.
Hoping this is helpful.
P.S. : I am coding with C language a utility for extracting speex from OggS and wrapping it in a FLV container, and I have forgotten the AudioTagHeader byte in the tag body. You reminded me it when you wrote about the sended bytes to the server.