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

Previously, we had separate MSG_SET_SURFACE and MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER messages for setting different types of supported output. Use of these constants to switch between outputs during use of a player was confusing because not all video renderers support both message types. To switch from VideoDecoderOutputBufferRenderer to a Surface, it was sufficient just to send MSG_SET_SURFACE, since all video renderers support this and clear any other output that might be set. Conversely, to switch in the opposite direction, just sending a MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER was not sufficient, because not all video renderers handle this message to clear any previous output. Hence it was necessary to explicitly clear a previously set surface using a separate MSG_SET_SURFACE message. Passing two messages to switch the output may prevent renderers from implementing the output switch efficiently. This change passes all outputs using a single message type, and requires that all renderers treat unsupported outputs as though null were passed (i.e., they clear any existing output). There are some other miscellaneous improvements: 1. Non-surface outputs are now passed to onRenderedFirstFrame. This fixes a bug in SimpleExoPlayer's onRenderedFirstFrame, where previously it could not correctly equality check the output corresponding to the event to its current output in the VideoDecoderOutputBufferRenderer case. 2. Fix SimpleExoPlayer to report surface size changes for the VideoDecoderOutputBufferRenderer case. Even though the surface is rendered to indirectly in this case, we can still query (and listen to changes to) the surface's size. PiperOrigin-RevId: 368215850
ExoPlayer library
The ExoPlayer library is split into multiple modules. See ExoPlayer's top level README for more information about the available library modules and how to use them.