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

MMSW-13526: Enable async mode by default for FTVE devices #11

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

jdtremblay
Copy link
Member

This PR bring a fix made by Amazon on their exoplayer-amazon-port.

Original description

[Problem]
There are frame drops and performance issues with 60fps content on some Amazon SmartTv (FTVE) devices.

[Solution]
We identified that switching the MediaCodec APIs to asynchronous buffer queueing mode improves the performance and reduces frame drops. We enable async mode by default for FTVE devices with API level >= 28. Developers still have the option to disable async mode with DefaultRenderersFactory.forceDisableMediaCodecAsynchronousQueueing() if they wish to do so.

cr: https://code.amazon.com/reviews/CR-92572712

[Problem]
There are frame drops and performance issues with 60fps content on some Amazon SmartTv (FTVE) devices.

[Solution]
We identified that switching the MediaCodec APIs to asynchronous buffer queueing mode improves the performance and reduces frame drops. We enable async mode by default for FTVE devices with API level >= 28. Developers still have the option to disable async mode with DefaultRenderersFactory.forceDisableMediaCodecAsynchronousQueueing() if they wish to do so.

cr: https://code.amazon.com/reviews/CR-92572712
@jdtremblay jdtremblay merged commit 7624d70 into amazon-port Feb 21, 2024
@jdtremblay jdtremblay deleted the MMSW-13526 branch February 22, 2024 15:40
@flambert flambert mentioned this pull request Feb 22, 2024
jdtremblay added a commit that referenced this pull request Apr 23, 2024
We found an issue when CC are enabled that was causing video freezes.

The root cause of the issue is somewhat similar to the one that's been fixed in #11.

In this case, the TextRenderer (CCs) blocks the period transitions because it's not done reading its input buffer until it's a bit too late. We have a cue every frame, which means 60 cues per second in live. The CEA codec has a pool of 10 input buffers, and the TextRenderer reads its buffer and sends it pretty much directly to the codec. That means the renderer can only deplete its input buffer approximately 0.17 secs before the end of the period. This is a bit tight on some platform(s), and can cause audio buffer underruns, which in turn causes video freezes, and can even cause some sort of rendering deadlocks on said platform(s).

This PR Increases the CEA decoder input buffers count to 100. That way the TextRenderer is very unlikely to be the one blocking the period transition. In my tests, it went back to being the video renderer always the last to be ready to transition to the next period.
jdtremblay added a commit that referenced this pull request Apr 23, 2024
We found an issue when CC are enabled that was causing video freezes.

The root cause of the issue is somewhat similar to the one that's been fixed in #11.

In this case, the TextRenderer (CCs) blocks the period transitions because it's not done reading its input buffer until it's a bit too late. We have a cue every frame, which means 60 cues per second in live. The CEA codec has a pool of 10 input buffers, and the TextRenderer reads its buffer and sends it pretty much directly to the codec. That means the renderer can only deplete its input buffer approximately 0.17 secs before the end of the period. This is a bit tight on some platform(s), and can cause audio buffer underruns, which in turn causes video freezes, and can even cause some sort of rendering deadlocks on said platform(s).

This PR Increases the CEA decoder input buffers count to 100. That way the TextRenderer is very unlikely to be the one blocking the period transition. In my tests, it went back to being the video renderer always the last to be ready to transition to the next period.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants