mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-02-24 06:50:07 +00:00

As some devices not present in ExoPlayer's list may not implement MediaCodec.setOutputSurface(Surface) properly, this workaround could be useful on these devices. It forces ExoPlayer to fall back on releasing and re-instantiating video codec instances, which is always used on Android 5 and lower due to addition of this method in Android 6. To do so, a CustomMediaCodecVideoRenderer, based on ExoPlayer's MediaVideoCodecRenderer which always return true for the codecNeedsSetOutputSurfaceWorkaround method has been added, which is used in CustomRenderersFactory, a class based on DefaultRenderersFactory which always returns our CustomMediaCodecVideoRenderer as the video renderers. CustomRenderersFactory replaces DefaultRenderersFactory in the player, in the case this setting is enabled.