Bug 5622637 missing XA_PLAYEVENT_HEADATPOS
Fix problem with a missing XA_PLAYEVENT_HEADATPOS after seek backwards,
due to a race condition between getPosition and onSeekComplete.
Change-Id: I408c8675df8a9b3cbd2874435fbeccdca355bc46
diff --git a/src/android/android_GenericPlayer.cpp b/src/android/android_GenericPlayer.cpp
index 10e613f..85a8b1a 100644
--- a/src/android/android_GenericPlayer.cpp
+++ b/src/android/android_GenericPlayer.cpp
@@ -600,6 +600,12 @@
}
}
+ // if we observe the player position going backwards, even without without a seek, then recover
+ if (mObservedPositionMs != ANDROID_UNKNOWN_TIME && positionMs < mObservedPositionMs) {
+ mDeliveredNewPosMs = ANDROID_UNKNOWN_TIME;
+ mObservedPositionMs = positionMs;
+ }
+
// delayUs is the expected delay between current position and marker;
// the default is infinity in case there are no upcoming marker(s)
int64_t delayUs = -1;