Skip to content

Commit 853d8c7

Browse files
committed
Seek to the beginning if start() is called on an AAH_TXPlayer that has completed playback
Bug: 6486022 Change-Id: I4daaf0f1feb1047a12480397598af6c52f54a6b6
1 parent 1903a73 commit 853d8c7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

media/libaah_rtp/aah_tx_player.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,12 @@ status_t AAH_TXPlayer::play_l() {
525525
return INVALID_OPERATION;
526526
}
527527

528+
if (mFlags & AT_EOS) {
529+
// Legacy behaviour, if a stream finishes playing and then
530+
// is started again, we play from the start...
531+
seekTo_l(0);
532+
}
533+
528534
mFlags |= PLAYING;
529535
updateClockTransform_l(false);
530536
postPumpAudioEvent_l(-1);
@@ -676,6 +682,7 @@ status_t AAH_TXPlayer::seekTo(int msec) {
676682
status_t AAH_TXPlayer::seekTo_l(int64_t timeUs) {
677683
mIsSeeking = true;
678684
mEOSResendTimeout.setTimeout(-1);
685+
mFlags &= ~AT_EOS;
679686
mSeekTimeUs = timeUs;
680687

681688
mCurrentClockTransformValid = false;
@@ -1199,8 +1206,10 @@ void AAH_TXPlayer::onPumpAudio() {
11991206
pause_l(false);
12001207
notifyListener_l(MEDIA_PLAYBACK_COMPLETE);
12011208
mEOSResendTimeout.setTimeout(-1);
1209+
mFlags |= AT_EOS;
12021210

12031211
// Return directly from here to avoid rescheduling ourselves.
1212+
mPumpAudioEventPending = false;
12041213
return;
12051214
}
12061215

@@ -1255,13 +1264,15 @@ void AAH_TXPlayer::onPumpAudio() {
12551264
pause_l(false);
12561265
notifyListener_l(MEDIA_PLAYBACK_COMPLETE);
12571266
mEOSResendTimeout.setTimeout(-1);
1267+
mFlags |= AT_EOS;
12581268
} else {
12591269
// Break out of the loop to reschude ourselves.
12601270
break;
12611271
}
12621272
} else {
12631273
LOGE("*** %s read failed err=%d", __PRETTY_FUNCTION__, err);
12641274
}
1275+
mPumpAudioEventPending = false;
12651276
return;
12661277
}
12671278

media/libaah_rtp/aah_tx_player.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class AAH_TXPlayer : public MediaPlayerHWInterface {
8282
PLAYING = 1,
8383
PREPARING = 8,
8484
PREPARED = 16,
85+
AT_EOS = 32,
8586
PREPARE_CANCELLED = 64,
8687
CACHE_UNDERRUN = 128,
8788

0 commit comments

Comments
 (0)