     CONFIG::LOGGING {
         import org.mangui.hls.utils.Log;
     }
-    /** Constants and utilities for the AAC audio format. **/
+    /** Constants and utilities for the AAC audio format, refer to 
+     *  http://wiki.multimedia.cx/index.php?title=ADTS
+     **/
     public class AACDemuxer implements Demuxer {
-        /** ADTS Syncword (111111111111), ID (MPEG4), layer (00) and protection_absent (1).**/
+        /** ADTS Syncword (0xFFF), ID:0 (MPEG4), layer (00) and protection_absent (1:no CRC).**/
         private static const SYNCWORD : uint = 0xFFF1;
-        /** ADTS Syncword with MPEG2 stream ID (used by e.g. Squeeze 7). **/
+        /** ADTS Syncword (0xFFF), ID:1 (MPEG2), layer (00) and protection_absent (1: no CRC).**/
         private static const SYNCWORD_2 : uint = 0xFFF9;
-        /** ADTS Syncword with MPEG2 stream ID (used by e.g. Envivio 4Caster). **/
+        /** ADTS Syncword (0xFFF), ID:1 (MPEG2), layer (00) and protection_absent (0: CRC).**/
         private static const SYNCWORD_3 : uint = 0xFFF8;
         /** ADTS/ADIF sample rates index. **/
         private static const RATES : Array = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350];

                    if (frame_start) {
                        frames.push(new AudioFrame(frame_start, frame_length, frame_length, samplerate));
                    }
                    if (short == SYNCWORD_3) {
                        // ADTS header is 9 bytes.
                        frame_length = ((adts.readUnsignedInt() & 0x0003FFE0) >> 5) - 9;
                        frame_start = adts.position + 3;
                        adts.position += frame_length + 3;
                    } else {
                        // ADTS header is 7 bytes.
                        frame_length = ((adts.readUnsignedInt() & 0x0003FFE0) >> 5) - 7;
                        frame_start = adts.position + 1;
                        adts.position += frame_length + 1;
                    }
                } else {
                    CONFIG::LOGGING {
                        Log.debug("no ADTS header found, probing...");
                    }
                    adts.position--;
                }

            // we need at least 6 bytes, 2 for sync word, 4 for frame length
            while ((adts.bytesAvailable > 5) && (short != SYNCWORD) && (short != SYNCWORD_2) && (short != SYNCWORD_3)) {
                short = adts.readUnsignedShort();
                adts.position--;
            }
            adts.position++;
            if (short == SYNCWORD || short == SYNCWORD_2 || short == SYNCWORD_3) {
                var profile : uint = (adts.readByte() & 0xF0) >> 6;
                // Correcting zero-index of ADIF and Flash playing only LC/HE.
