You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Black frames occur when switching between frame rates on devices with API levels below 30 #3120
Play a video with multiple video tracks that have different frame rates (e.g. 1080p25 & 1080p50)
Wait for the stream to switch to the highest quality stream (switch from 25 fps to 50 fps)
Expected result
Stream switch happens without black frames
Actual result
While stream is switched, a black frame is displayed
Media
It appears the change introduced in #2941 (Diff) is the root cause of this issue. While I don't fully follow the reasoning behind these changes, they have significantly degraded the playback experience. If a stream switches frame rates frequently, the resulting constant flickering is quite disruptive for the user.
As a temporary measure, we have set VideoChangeFrameRateStrategy to VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF for API levels below 30. This successfully prevents the black frames from occurring.
The fix you referenced from #2941 was to ensure playback isn't stuttering after the frame rate switch because the graphics pipeline didn't adjust the screen refresh rate to the content.
The unfortunate side effect is that some devices (not all), show a black frame for secure codecs when detaching a Surface. So this is what you are seeing here. See some old issues about it in google/ExoPlayer#8842 or google/ExoPlayer#8568.
So it seems we have a choice between a black frame at the transition point or a slight permanent stuttering of the video frame release after the transition... I'd say the black frame is worst for a dynamic format change, but better for a full transition between different items. Would you agree with that? The other interesting aspect is that you've probably never seen the stuttering before because 25fps and 50fps should be nicely compatible even if the screen refresh rate isn't updated. (The other issue was reporting it in the context of 25fps/60fps switches).
This means I'm looking into two adjustments:
For mid-stream adaptive switches, only apply the reset for non-secure decoders.
Only apply the reset of the codec if the frame rates are not a multiple of each other (e.g. 25/50 or 30/60 transitions would never trigger it).
Thank you very much for the detailed rundown. I completely agree with your assessment; you are also correct that we hadn't noticed any stuttering, which is why the black frames feel like a net negative for our use case.
Considering the adjustments you outlined, this seems like a good improvement. 👍
Activity
tonihei commentedon Mar 12, 2026
Thanks for reporting!
The fix you referenced from #2941 was to ensure playback isn't stuttering after the frame rate switch because the graphics pipeline didn't adjust the screen refresh rate to the content.
The unfortunate side effect is that some devices (not all), show a black frame for secure codecs when detaching a Surface. So this is what you are seeing here. See some old issues about it in google/ExoPlayer#8842 or google/ExoPlayer#8568.
So it seems we have a choice between a black frame at the transition point or a slight permanent stuttering of the video frame release after the transition... I'd say the black frame is worst for a dynamic format change, but better for a full transition between different items. Would you agree with that? The other interesting aspect is that you've probably never seen the stuttering before because 25fps and 50fps should be nicely compatible even if the screen refresh rate isn't updated. (The other issue was reporting it in the context of 25fps/60fps switches).
This means I'm looking into two adjustments:
mikef-dk commentedon Mar 13, 2026
Thank you very much for the detailed rundown. I completely agree with your assessment; you are also correct that we hadn't noticed any stuttering, which is why the black frames feel like a net negative for our use case.
Considering the adjustments you outlined, this seems like a good improvement. 👍
Fine tune codec reuse logic for frame rate changes on API<30
tonihei commentedon Mar 20, 2026
The suggested changes are now submitted with the commit above.
Fine tune codec reuse logic for frame rate changes on API<30