mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

Before this change, the player state would be STATE_ENDED then STATE_BUFFERING (when the postroll ad was marked as played) then STATE_ENDED again. Queueing a final content media period with start point equal to the content duration after a postroll ensures that the player state doesn't change to STATE_ENDED transiently. Switch from using C.TIME_END_OF_SOURCE to C.TIME_UNSET for media periods that should not have an end point and are not followed by an ad. Content media periods before postrolls have end position C.TIME_END_OF_SOURCE. If the postroll ad loads, its content position is set to the content duration, which should be known at the point of loading the postroll, then a final 'empty' content media period with start position equal to its duration is queued. If the postroll fails to load, this empty content media period is queued up directly after the preceding content media period. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219443683