MCVR.hasSurfaceForCodec considers VideoSink

This change keeps getSurfaceForCodec and hasSurfaceForCodec in sync.
Before this change when ExoPlayer is configured with setVideoEffects
and no display surface, codecs that need Set Output Surface Workaround
would not be initialized because hasSurfaceForCodec always returns false

PiperOrigin-RevId: 692900899
This commit is contained in:
dancho 2024-11-04 03:14:56 -08:00 committed by Copybara-Service
parent aebda58314
commit bd90ef38b0

View File

@ -1815,7 +1815,8 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
}
private boolean hasSurfaceForCodec(MediaCodecInfo codecInfo) {
return (displaySurface != null && displaySurface.isValid())
return videoSink != null
|| (displaySurface != null && displaySurface.isValid())
|| shouldUseDetachedSurface(codecInfo)
|| shouldUsePlaceholderSurface(codecInfo);
}