       container.writeByte(0x01 << 4 | 0x07); // Keyframe << 4 | CodecID
       container.writeUnsignedInt(0x00 << 24 | 0x00000000); // AVC NALU << 24 | CompositionTime
 
-      writeDecoderConfigurationRecord();
+      var profilelevelid:uint = parseInt(params.profile, 16);
+      writeDecoderConfigurationRecord(profilelevelid);
       writeParameterSets(sps, pps);
+      this.sps = EMPTY_BUF;
+      this.pps = EMPTY_BUF;
 
       var size:uint = container.position - start;
 


      /* Method call */
      size += writeString("onMetaData");

      /* Decode the base64 encoded parameter sets to pass to parseSPS */
      var sets:Array = sdp.getMediaBlock('video').fmtp['sprop-parameter-sets'].split(',');
      var spsdec:Base64Decoder = new Base64Decoder();
      spsdec.decode(sets[0]);
      var sps:BitArray = new BitArray(spsdec.toByteArray());
      var params:Object = parseSPS(sps);
      Logger.log('FLVMux: stream params = ', params);

      /* Arguments */
      size += writeECMAArray({

        break;

      case 7: /* Sequence parameter set */
        this.sps = nalu.getPayload();
        createVideoSpecificConfigTag();
        break;

      case 8: /* Picture parameter set */
        this.pps = nalu.getPayload();
        createVideoSpecificConfigTag();
        break;

      default:
