3
votes

On my targeting device I need to force ExoPlayer to use a specific codec, during testing if I modify the getDecoderInfo() function of MediaCodecSelector DEFAULT implementation, things work well.

However for the real product I prefer not to modify the source of ExoPlayer. I saw some post saying you can implement your own MediaCodecSelector, but I failed to figure out how.

If I'm to subclass SimpleExoPlayer, since the use of MediaCodecSelector.DEFAULT is hardcoded into buildVideoRenderers() of SimpleExoPlayer, I'm thinking to override buildVideoRenderers(), however I don't have access to the private properties, and even if I had it will end up with duplicated code.

Or if I'm to implement ExoPlayer, seems it will depend on even more private classes.

I suppose the standard way to do it is none of the above.

1
I think the standard way with exoplayer is to fork if you need to. Could you explain what issues you have with overriding buildVideoRenderers? Maybe it will help if you explain in more detail what exact issues your are trying to resolve. - Okas

1 Answers

0
votes

I ended up using the following factory function of ExoPlayerFactory: public static ExoPlayer newInstance(Renderer[] renderers, TrackSelector trackSelector). Where I create the Renderer with my own MediaCodecSelector.

Then only difference is how to set up surface view, and sendMessage of type MSG_SET_SURFACE works for me.