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

Adding a CHANGE_FRAME_RATE_STRATEGY_ALWAYS strategy is omitted from this commit, since adding it is more complicated than just plumbing it through and leaving everything else unchanged. Specifically, VideoFrameReleaseTimeHelper would need updating to behave differently when such a strategy is enabled. It currently calls setFrameRate in cases such as pausing, seeking and re-buffering, on the assumption that changes to the underlying display refresh rate will only be made if they can be done seamlessly. For a mode in which this will not be the case, it makes more sense to stick to the content frame-rate when these events occur. It may also make sense to only use explicit content frame-rate values, and not those inferred from individual frame timestamps. Finally, for adaptive content containing a mix of frame-rates, it makes sense to use the maximal frame-rate across all variants, and to avoid calling setFrameRate on switches from one variant to another. Applications that know the frame-rate of their content can set ExoPlayer's strategy to CHANGE_FRAME_RATE_STRATEGY_OFF and then use setFrameRate directly on the output surface. Note that this is likely to be a better option for apps than anything we could implement in ExoPlayer, because the application layer most likely knows the frame-rate of the content earlier than ExoPlayer does (e.g., to perform the disruptive mode switch at the same time as an activity transition). Adding CHANGE_FRAME_RATE_STRATEGY_ALWAYS will be deferred until there's clear demand for it. In the meantime, we'll recommend the alternative approach above. PiperOrigin-RevId: 389610965