added the method setMaximumNumberOfFrames and implemented the producer consumer model