anchor.diff:    (flexi-streams:with-input-from-sequence (is +avi-dht+)
       (jpeg::read-dht (jpeg-descriptor rec) is))
     (setf (buffer rec) (make-array (suggested-buffer-size rec) :element-type '(unsigned-byte 8))
  -	(chunk-queue rec) (make-list (* 2 (floor (rate rec) (scale rec)))))
  +	(chunk-queue rec) (make-list (max 5 (* 2 (floor (rate rec) (scale rec)))))) ;at least 5 chunks to prevent cursor deadlocks
     (loop for chunk on (chunk-queue rec) do
          (setf (car chunk) (make-instance 'chunk :frame (jpeg:allocate-buffer (height (avi rec)) (width (avi rec)) 3))))
     (setf (cdr (last (chunk-queue rec))) (chunk-queue rec)
   	(rcursor rec) (chunk-queue rec)
  -	(wcursor rec) (chunk-queue rec)))
  +	(wcursor rec) (cdr (chunk-queue rec))))
   
   (defclass audio-stream-record (stream-record)
     ())
  
positive.code:    (flags :accessor flags)
     (nstreams :accessor nstreams)
     (player-callback :accessor player-callback :initarg :player-callback :initform nil) ;;called once all headers are processed
     (finished :accessor finished :initform nil)
     (stream-records :accessor stream-records)))
  
  (defgeneric decode-media-stream (record fsize input-stream))
  
negative.code:    (chunk-queue :accessor chunk-queue)
     (rcursor :accessor rcursor)
     (wcursor :accessor wcursor)
     (final :accessor final :initform nil)
     (avi :accessor avi :initarg :avi)))
  
  (defmethod stream-playback-start ((rec stream-record))
    (bt:acquire-lock (vacancy-lock (car (rcursor rec)))))
  
  (defmethod stream-playback-stop ((rec stream-record))
    (bt:release-lock (vacancy-lock (car (rcursor rec)))))
  
  (defclass mjpeg-stream-record (stream-record)
    ((buffer :accessor buffer :type '(unsigned-byte 8))
  