diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2010-04-14 10:40:28 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2010-04-14 10:40:28 -0700 |
commit | cbe4b2cb591b5e7a6a25ee4ef85aaa61c537fef0 (patch) | |
tree | 40445880058f40b9919f93b4edb4e26df2f02610 /media | |
parent | 53fbf1d2eebd09e14a8995f51c47788670dbab1e (diff) | |
download | frameworks_av-cbe4b2cb591b5e7a6a25ee4ef85aaa61c537fef0.zip frameworks_av-cbe4b2cb591b5e7a6a25ee4ef85aaa61c537fef0.tar.gz frameworks_av-cbe4b2cb591b5e7a6a25ee4ef85aaa61c537fef0.tar.bz2 |
fix unintentional drift
Change-Id: I0bbf3d3f95296a41d71558d8de1ed2ed021f21cf
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 6 | ||||
-rw-r--r-- | media/libstagefright/codecs/aacdec/AACDecoder.cpp | 31 |
2 files changed, 23 insertions, 14 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index b22025a..b14a03c 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -444,6 +444,8 @@ void AwesomePlayer::onBufferingUpdate() { notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage * 100.0); postBufferingEvent_l(); + } else { + LOGE("Not sending buffering status because duration is unknown."); } } @@ -552,8 +554,6 @@ status_t AwesomePlayer::play_l() { seekAudioIfNecessary_l(); } - postBufferingEvent_l(); - if (mFlags & AT_EOS) { // Legacy behaviour, if a stream finishes playing and then // is started again, we play from the start... @@ -1230,6 +1230,8 @@ void AwesomePlayer::onPrepareAsyncEvent() { mFlags |= PREPARED; mAsyncPrepareEvent = NULL; mPreparedCondition.broadcast(); + + postBufferingEvent_l(); } status_t AwesomePlayer::suspend() { diff --git a/media/libstagefright/codecs/aacdec/AACDecoder.cpp b/media/libstagefright/codecs/aacdec/AACDecoder.cpp index 2ed8ef1..ae23691 100644 --- a/media/libstagefright/codecs/aacdec/AACDecoder.cpp +++ b/media/libstagefright/codecs/aacdec/AACDecoder.cpp @@ -203,25 +203,32 @@ status_t AACDecoder::read( Int decoderErr = PVMP4AudioDecodeFrame(mConfig, mDecoderBuf); + size_t numOutBytes = + mConfig->frameLength * sizeof(int16_t) * mConfig->desiredChannels; + if (decoderErr != MP4AUDEC_SUCCESS) { - LOGE("AAC decoder returned error %d", decoderErr); + LOGW("AAC decoder returned error %d, substituting silence", decoderErr); - buffer->release(); - buffer = NULL; + memset(buffer->data(), 0, numOutBytes); - return ERROR_MALFORMED; + // Discard input buffer. + mInputBuffer->release(); + mInputBuffer = NULL; + + // fall through } - buffer->set_range( - 0, mConfig->frameLength * sizeof(int16_t) * mConfig->desiredChannels); + buffer->set_range(0, numOutBytes); - mInputBuffer->set_range( - mInputBuffer->range_offset() + mConfig->inputBufferUsedLength, - mInputBuffer->range_length() - mConfig->inputBufferUsedLength); + if (mInputBuffer != NULL) { + mInputBuffer->set_range( + mInputBuffer->range_offset() + mConfig->inputBufferUsedLength, + mInputBuffer->range_length() - mConfig->inputBufferUsedLength); - if (mInputBuffer->range_length() == 0) { - mInputBuffer->release(); - mInputBuffer = NULL; + if (mInputBuffer->range_length() == 0) { + mInputBuffer->release(); + mInputBuffer = NULL; + } } buffer->meta_data()->setInt64( |