@Override public void run(){
synchronized (mSync) {
    mRequestStop=false;
    mRequestDrain=0;
    mSync.notify();
  }
  final boolean isRunning=true;
  boolean localRequestStop;
  boolean localRequestDrain;
  while (isRunning) {
synchronized (mSync) {
      localRequestStop=mRequestStop;
      localRequestDrain=(mRequestDrain > 0);
      if (localRequestDrain)       mRequestDrain--;
    }
    if (localRequestStop) {
      drain();
      signalEndOfInputStream();
      drain();
      release();
      break;
    }
    if (localRequestDrain) {
      drain();
    }
 else {
synchronized (mSync) {
        try {
          mSync.wait();
        }
 catch (        final InterruptedException e) {
          break;
        }
      }
    }
  }
  if (DEBUG)   Log.d(TAG,"Encoder thread exiting");
synchronized (mSync) {
    mRequestStop=true;
    mIsCapturing=false;
  }
}

@ Override public void run ( ) { synchronized ( mSync ) { mRequestStop = false ; mRequestDrain = 0 ; mSync . notify ( ) ; } final boolean isRunning = true ; boolean localRequestStop ; boolean localRequestDrain ; while ( isRunning ) { synchronized ( mSync ) { localRequestStop = mRequestStop ; localRequestDrain = ( mRequestDrain > 0 ) ; if ( localRequestDrain ) mRequestDrain -- ; } if ( localRequestStop ) { drain ( ) ; signalEndOfInputStream ( ) ; drain ( ) ; release ( ) ; break ; } if ( localRequestDrain ) { drain ( ) ; } else { synchronized ( mSync ) { try { mSync . wait ( ) ; } catch ( final InterruptedException e ) { break ; } } } } if ( DEBUG ) Log . d ( TAG , "Encoder thread exiting" ) ; synchronized ( mSync ) { mRequestStop = true ; mIsCapturing = false ; } }
encoding loop on private thread
