DummyAudioSource *pDummyAudioSource = (DummyAudioSource*)pMediaSrc;
//Increment the duration of audio source
pDummyAudioSource->setDuration((int64_t)((mPlayEndTimeMsec)*1000));
+
+ // Stop the new audio source
+ // since we continue using old source
+ LOGV("setAudioPlayer: stop new audio source");
+ mAudioSource->stop();
}
}
}
}
void VideoEditorAudioPlayer::setSource(const sp<MediaSource> &source) {
Mutex::Autolock autoLock(mLock);
+
+ // Before setting source, stop any existing source.
+ // Make sure to release any buffer we hold onto so that the
+ // source is able to stop().
+
+ if (mFirstBuffer != NULL) {
+ mFirstBuffer->release();
+ mFirstBuffer = NULL;
+ }
+
+ if (mInputBuffer != NULL) {
+ LOGV("VideoEditorAudioPlayer releasing input buffer.");
+
+ mInputBuffer->release();
+ mInputBuffer = NULL;
+ }
+
+ if (mSource != NULL) {
+ mSource->stop();
+ mSource.clear();
+ }
+
mSource = source;
mReachedEOS = false;
}
mObserver = observer;
}
-
bool VideoEditorAudioPlayer::isStarted() {
return mStarted;
}