@@ -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) {
676682status_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
0 commit comments