Merge "If audio startup fails while executing MediaPlayer::start() do NOT post an error"

This commit is contained in:
Andreas Huber
2011-07-14 13:22:45 -07:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 5 deletions

View File

@@ -890,7 +890,11 @@ status_t AwesomePlayer::play_l() {
CHECK(!(mFlags & AUDIO_RUNNING));
if (mVideoSource == NULL) {
status_t err = startAudioPlayer_l();
// We don't want to post an error notification at this point,
// the error returned from MediaPlayer::start() will suffice.
status_t err = startAudioPlayer_l(
false /* sendErrorNotification */);
if (err != OK) {
delete mAudioPlayer;
@@ -940,7 +944,7 @@ status_t AwesomePlayer::play_l() {
return OK;
}
status_t AwesomePlayer::startAudioPlayer_l() {
status_t AwesomePlayer::startAudioPlayer_l(bool sendErrorNotification) {
CHECK(!(mFlags & AUDIO_RUNNING));
if (mAudioSource == NULL || mAudioPlayer == NULL) {
@@ -958,7 +962,10 @@ status_t AwesomePlayer::startAudioPlayer_l() {
true /* sourceAlreadyStarted */);
if (err != OK) {
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
if (sendErrorNotification) {
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, err);
}
return err;
}
@@ -1684,7 +1691,7 @@ void AwesomePlayer::onVideoEvent() {
if (mAudioPlayer != NULL && !(mFlags & (AUDIO_RUNNING | SEEK_PREVIEW))) {
status_t err = startAudioPlayer_l();
if (err != OK) {
LOGE("Startung the audio player failed w/ err %d", err);
LOGE("Starting the audio player failed w/ err %d", err);
return;
}
}

View File

@@ -291,7 +291,7 @@ private:
void finishSeekIfNecessary(int64_t videoTimeUs);
void ensureCacheIsFetching_l();
status_t startAudioPlayer_l();
status_t startAudioPlayer_l(bool sendErrorNotification = true);
void postAudioSeekComplete_l();
void shutdownVideoDecoder_l();