code: public void run() {
      boolean process = true;
      synchronized(this) {
        BlockEncodeRequest ber = manager.getWaitingRequest();
        if(ber != null && ber.frameNumber < 0)
           ber = null;
        while(ber != null && process) {
          if(ber.frameNumber < 0) {
            process = false;
          }
          else {//get available BlockEncodeRequest from manager
            ber.encodedSamples = frame.encodeSamples(ber.samples, ber.count,
            ber.start, ber.skip, ber.result, ber.frameNumber);
            ber.valid = true;
            manager.returnFinishedRequest(ber);
            ber = manager.getWaitingRequest();
          }
        }
        manager.notifyFrameThreadExit(this);
      }
    }
docs: Run method. This FrameThread will get a BlockEncodeRequest from the
  BlockThreadManager, encode the block, return it to the manager, then
  repeat. If no BlockEncodeRequest is available, or if it recieves a
  request with the "frameNumber" field set to a negative value, it will
  break the loop and end, notifying the manager it has ended.