Open yogesh-hacker opened 2 weeks ago
Hello @yogesh-hacker
Thank you for reporting your issue. I believe that you are asking how you might force to use a software decoder?
An app can implement a workaround to remove a potential decoder as follows (bottom-up):
The app should override MediaCodecVideoRenderer.getDecoderInfos() roughly as follows:
protected List<MediaCodecInfo> getDecoderInfos(
MediaCodecSelector mediaCodecSelector, Format format, boolean requiresSecureDecoder)
throws DecoderQueryException {
List<MediaCodecInfo> decoderInfos = super.getDecoderInfos(mediaCodecSelector, format, requiresSecureDecoder);
if (//Insert condition here like specific sampleMimeType or format resolution is 1080p) {
// check if decoderInfos contains the decoder that is hardwareAccelerated
// if yes, return a copy of the decoderInfos list excluding that decoder
}
The app can inject the custom renderer by overriding DefaultRenderersFactory.buildVideoRenderers() The player should be created with your custom DefaultRenderersFactory by passing it in the ExoPlayer.Builder constructor, or with ExoPlayer.Builder.setRenderersFactory.
Hope that helps!
I have searched a lot for this everyone posted portions or half code.
I have URL that plays a mkv video with quality 1080p the problem is in my app and in MX Player with HW buffers more than 1- 5 mins. But when I switch the decoder to SW it plays the video instantly. I don't know how MX Player implemented Software Decoder. I want that too...
I have tried using Renderer Mode on, off and prefer it doesn't work at all....
https://github.com/androidx/media/assets/58415010/a6271af3-90e2-4ae2-9b77-ce5c0c6c84e4