[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make my ExoPlayer to support software decoder especially while streaming of mkv container? #1460

Open
yogesh-hacker opened this issue Jun 14, 2024 · 1 comment

Comments

@yogesh-hacker
Copy link
yogesh-hacker commented Jun 14, 2024

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....

km_20240614_480p_60f_20240614_170241.mp4
@microkatz
Copy link
Contributor

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!

@microkatz microkatz self-assigned this Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants