mirror of
https://github.com/androidx/media.git
synced 2025-05-04 22:20:47 +08:00

handleSourceInfoRefreshed checks for various conditions which may trigger a change in position. In all cases, we need to resolve the new position for ads, and if the corresponding MediaPeriods already exist, perform the seek to the new position. This change simplified the code by 1. Moving all conditions in a single if-else structure which just determines the new playback position. This makes it easier to read and to follow. 2. Doing the subsequent seek and position update in one final step to remove duplicated code. As a side effect, it also improves some edge cases. For example when skipping an ad to an already prebuffered period, we now properly update the existing prebuffered period. PiperOrigin-RevId: 243588014