fix unintentional drift
Change-Id: I0bbf3d3f95296a41d71558d8de1ed2ed021f21cf
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
buffer->set_range(
|
||||
0, mConfig->frameLength * sizeof(int16_t) * mConfig->desiredChannels);
|
||||
|
||||
mInputBuffer->set_range(
|
||||
mInputBuffer->range_offset() + mConfig->inputBufferUsedLength,
|
||||
mInputBuffer->range_length() - mConfig->inputBufferUsedLength);
|
||||
|
||||
if (mInputBuffer->range_length() == 0) {
|
||||
// Discard input buffer.
|
||||
mInputBuffer->release();
|
||||
mInputBuffer = NULL;
|
||||
|
||||
// fall through
|
||||
}
|
||||
|
||||
buffer->set_range(0, numOutBytes);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
buffer->meta_data()->setInt64(
|
||||
|
||||
Reference in New Issue
Block a user