示例#1
0
 @Override
 public void start() {
   MediaPlayerDataSource restartWithThisDataSource = null;
   synchronized (lock) {
     check(!mHasBeenReleased, "has been released, reset before use");
     check(mIsPrepared, "must have prepared before you can start");
     if (!mHasStartedPlayback) {
       // Playback has not started. Start it.
       mHasStartedPlayback = true;
       EngineParameters engineParameters =
           new EngineParameters.Builder()
               .initialRate(mCurrentPlaybackRate)
               .startPositionMillis(mStartPosition)
               .audioStreamType(mAudioStreamType)
               /// M: add more buffer to smooth audio ALPS00712496 and ALPS00723581 @{
               .maxPlayBufferCount(8)
               .decodeBufferMaxSize(40960)
               /// @}
               .build();
       VariableSpeedNative.initializeEngine(engineParameters);
       VariableSpeedNative.startPlayback();
       mEngineInitializedLatch.countDown();
       mExecutor.execute(new PlaybackRunnable(mDataSource));
     } else {
       // Playback has already started. Restart it, without holding the
       // lock.
       restartWithThisDataSource = mDataSource;
     }
   }
   if (restartWithThisDataSource != null) {
     stopAndStartPlayingAgain(restartWithThisDataSource);
   }
 }