Loading media/libstagefright/AudioPlayer.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "AudioPlayer" #include <utils/Log.h> Loading Loading @@ -136,7 +137,7 @@ void AudioPlayer::stop() { // Make sure to release any buffer we hold onto so that the // source is able to stop(). if (mInputBuffer != NULL) { LOGI("AudioPlayer releasing input buffer."); LOGV("AudioPlayer releasing input buffer."); mInputBuffer->release(); mInputBuffer = NULL; Loading Loading @@ -176,7 +177,7 @@ void AudioPlayer::AudioCallback(int event, void *info) { void AudioPlayer::fillBuffer(void *data, size_t size) { if (mNumFramesPlayed == 0) { LOGI("AudioCallback"); LOGV("AudioCallback"); } size_t size_done = 0; Loading Loading @@ -216,6 +217,11 @@ void AudioPlayer::fillBuffer(void *data, size_t size) { mPositionTimeRealUs = ((mNumFramesPlayed + size_done / mFrameSize) * 1000000) / mSampleRate; LOGV("buffer->size() = %d, " "mPositionTimeMediaUs=%.2f mPositionTimeRealUs=%.2f", mInputBuffer->range_length(), mPositionTimeMediaUs / 1E6, mPositionTimeRealUs / 1E6); } if (mInputBuffer->range_length() == 0) { Loading media/libstagefright/MediaPlayerImpl.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -147,7 +147,15 @@ void MediaPlayerImpl::play() { if (mAudioSource != NULL) { mAudioPlayer = new AudioPlayer(mAudioSink); mAudioPlayer->setSource(mAudioDecoder); if (mVideoDecoder == NULL) { // If there is no video, start playing right away, // otherwise we'll start the audio player after we decode // the first video frame, this way we won't be behind right // away. mAudioPlayer->start(); } mTimeSource = mAudioPlayer; } else { mTimeSource = new SystemTimeSource; Loading Loading @@ -276,6 +284,10 @@ void MediaPlayerImpl::videoEntry() { } if (firstFrame || seeking) { if (firstFrame && mAudioPlayer != NULL) { // We've deferred starting the audio player until now. mAudioPlayer->start(); } mTimeSourceDeltaUs = mTimeSource->getRealTimeUs() - pts_us; firstFrame = false; } Loading Loading
media/libstagefright/AudioPlayer.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "AudioPlayer" #include <utils/Log.h> Loading Loading @@ -136,7 +137,7 @@ void AudioPlayer::stop() { // Make sure to release any buffer we hold onto so that the // source is able to stop(). if (mInputBuffer != NULL) { LOGI("AudioPlayer releasing input buffer."); LOGV("AudioPlayer releasing input buffer."); mInputBuffer->release(); mInputBuffer = NULL; Loading Loading @@ -176,7 +177,7 @@ void AudioPlayer::AudioCallback(int event, void *info) { void AudioPlayer::fillBuffer(void *data, size_t size) { if (mNumFramesPlayed == 0) { LOGI("AudioCallback"); LOGV("AudioCallback"); } size_t size_done = 0; Loading Loading @@ -216,6 +217,11 @@ void AudioPlayer::fillBuffer(void *data, size_t size) { mPositionTimeRealUs = ((mNumFramesPlayed + size_done / mFrameSize) * 1000000) / mSampleRate; LOGV("buffer->size() = %d, " "mPositionTimeMediaUs=%.2f mPositionTimeRealUs=%.2f", mInputBuffer->range_length(), mPositionTimeMediaUs / 1E6, mPositionTimeRealUs / 1E6); } if (mInputBuffer->range_length() == 0) { Loading
media/libstagefright/MediaPlayerImpl.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -147,7 +147,15 @@ void MediaPlayerImpl::play() { if (mAudioSource != NULL) { mAudioPlayer = new AudioPlayer(mAudioSink); mAudioPlayer->setSource(mAudioDecoder); if (mVideoDecoder == NULL) { // If there is no video, start playing right away, // otherwise we'll start the audio player after we decode // the first video frame, this way we won't be behind right // away. mAudioPlayer->start(); } mTimeSource = mAudioPlayer; } else { mTimeSource = new SystemTimeSource; Loading Loading @@ -276,6 +284,10 @@ void MediaPlayerImpl::videoEntry() { } if (firstFrame || seeking) { if (firstFrame && mAudioPlayer != NULL) { // We've deferred starting the audio player until now. mAudioPlayer->start(); } mTimeSourceDeltaUs = mTimeSource->getRealTimeUs() - pts_us; firstFrame = false; } Loading