Skip to content

Commit 564fee3

Browse files
theandi666Android (Google) Code Review
authored andcommitted
Merge "Make sure we can properly shutdown even if" into ics-mr1
2 parents d12dc28 + 551aeac commit 564fee3

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

media/libmediaplayerservice/nuplayer/NuPlayer.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,24 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
463463
{
464464
LOGV("kWhatReset");
465465

466+
if (mRenderer != NULL) {
467+
// There's an edge case where the renderer owns all output
468+
// buffers and is paused, therefore the decoder will not read
469+
// more input data and will never encounter the matching
470+
// discontinuity. To avoid this, we resume the renderer.
471+
472+
if (mFlushingAudio == AWAITING_DISCONTINUITY
473+
|| mFlushingVideo == AWAITING_DISCONTINUITY) {
474+
mRenderer->resume();
475+
}
476+
}
477+
466478
if (mFlushingAudio != NONE || mFlushingVideo != NONE) {
467479
// We're currently flushing, postpone the reset until that's
468480
// completed.
469481

470-
LOGV("postponing reset");
482+
LOGV("postponing reset mFlushingAudio=%d, mFlushingVideo=%d",
483+
mFlushingAudio, mFlushingVideo);
471484

472485
mResetPostponed = true;
473486
break;

media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,16 @@ void NuPlayer::Renderer::onPause() {
628628
mAudioSink->pause();
629629
}
630630

631+
LOGV("now paused audio queue has %d entries, video has %d entries",
632+
mAudioQueue.size(), mVideoQueue.size());
633+
631634
mPaused = true;
632635
}
633636

634637
void NuPlayer::Renderer::onResume() {
635-
CHECK(mPaused);
638+
if (!mPaused) {
639+
return;
640+
}
636641

637642
if (mHasAudio) {
638643
mAudioSink->start();

0 commit comments

Comments
 (0)