Make MediaCodecVideoRenderer::shouldUsePlaceholderSurface protected.#1905
Make MediaCodecVideoRenderer::shouldUsePlaceholderSurface protected.#1905copybara-service[bot] merged 2 commits intoandroidx:mainfrom
Conversation
|
Thanks for submitting your request! Just a curiosity, have you looked at MediaCodecVideoRenderer::shouldInitCodec for your use case? Its already overridable and utilized by |
|
@microkatz Thanks for the suggestion, I'll experiment with it, but while this can prevent the initialization of the codec, it will still create the |
|
@microkatz We've tried your suggestion. The results don't seem very encouraging. We see significant increases in ANRs, memory kills and native crashes. The additional resources used by the placeholder surface seems to really conflict with some of the fine tuning that we've done for our scenarios. |
|
@microkatz: @khouzam and I discussed this code path in person as well and concluded that the protected access makes sense because the method is also used from |
This enables a derived renderer to disable the placeholder surface.
98ab7b9 to
ad18ae9
Compare
|
I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks! |
This enables a derived renderer to disable the placeholder surface.
Not having a placeholder surface allows to delay instantiating the codecs until we have a surface. This allows to have more players ready without having their decoders loaded.
This follows the mode that
shouldUseDetachedSurfaceis protected and overridable by a derived class.Since
getSurfaceForCodecmust callhasSurfaceForCodec, the check for the placeholder surface ingetSurfaceForCodecshould not trigger if we disable the placeholder surface ashasSurfaceForCodecwould have returned false.