 	 */
 	public class ILBCCodec extends EventDispatcher {
 		
+		/**
+		 * iLBC processes data in chunks of 240 shorts, 1 byte.
+		 * Flash records data as floats, which are 4 bytes.
+		 * Base64 prefers muliples of 3, so we multiply by that here.
+		 * 
+		 * 240 shorts * 4 (for sizeof( float )) * 3 (Base64 preference), leads to the "optimal" number here, results in no padding.
+		 */ 
+		public static const PREFERRED_MIN_CHUNK_SIZE:int = 2880;
+		
+		public static const NOISE_SUPPRESSION_OFF:int = 0;
+		public static const NOISE_SUPPRESSION_MILD:int = 1;
+		public static const NOISE_SUPPRESSION_MEDIUM:int = 2;
+		public static const NOISE_SUPPRESSION_AGGRESSIVE:int = 3;
+		
 		public var encodedData:ByteArray;
 		public var decodedData:ByteArray;
+		
+		private var isLastEncoding:Boolean;
+		private var isLastDecoding:Boolean;
 		
 		private var ilbcCodec:Object;
 		private var initTime:int;

		 * Called when decoding has finished.
		 */
		private function decodingCompleteHandler(event:*):void {
			trace("ILBCCodec.decodingCompleteHandler(event):", event);
			
			decodedData.position = 0;
			dispatchEvent( new ILBCEvent(ILBCEvent.DECODING_COMPLETE, decodedData, getElapsedTime()) );
		}

		

		
		/**
		 * Encodes an (16 bit 8kHz) audio stream to iLBC.
		 * 
		 * @param data The audio stream to encode.
		 * @param isLast Whether or not this is the last piece of the 
		 * 	(chunked) audio data to encode.
		 * @param noiseCancellationLevel (Optional) The noise suppression level to use while encoding the stream. 
		 * 	Allowed values are defined as constants at the top of this class. The default value is medium suppression.
		 */
		public function encode(data:ByteArray, isLast:Boolean = false, noiseSuppressionLevel:int = 2):void {
			trace("ILBCCodec.encode(data):", data.length);
			
			isLastEncoding = isLast;
			
			encodedData = new ByteArray();
			encodedData.endian = Endian.LITTLE_ENDIAN;
