media: Enable MediaCodec flush for Android 14+#11544
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the player components factory for Android to enable features like flushing during seek and resetting the audio decoder on devices running API level 34 (Android 14) or higher. The review feedback points out that directly calling android_get_device_api_level() can cause runtime crashes on older Android devices (API < 24) where the symbol is weak and may resolve to nullptr. To address this, the reviewer recommends introducing a safe helper function to check for null pointers and replacing the magic number 34 with a named constant, in line with the Chromium style guide.
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function GetDeviceApiLevel() to retrieve the Android API level and uses it to conditionally enable features like flushing during seek and resetting the audio decoder on Android U (API level 34) or higher. The review feedback suggests improving the robustness of GetDeviceApiLevel() on older Android versions (API < 24) by using __system_property_get as a fallback instead of relying on weak linking of android_get_device_api_level, which also requires including <sys/system_properties.h> and <cstdlib>.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function GetDeviceApiLevel() in media_common.h and uses it in player_components_factory.cc to automatically enable features like enable_flush_during_seek and enable_reset_audio_decoder on devices running Android U or higher. The review feedback suggests removing the unused kAndroidApiLevelPie constant and using std::atoi instead of atoi to align with standard C++ practices.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function GetDeviceApiLevel() in media_common.h to determine the Android API level of the device. It then uses this function in player_components_factory.cc to automatically enable certain media features, such as flushing during seek and resetting the audio decoder, on devices running Android U (API level 34) or higher. There are no review comments, so I have no feedback to provide.
Enable MediaCodec flushing during seeks and audio decoder resets by
default on devices running Android 14 (API level 34) or higher. This
ensures more reliable playback behavior on newer Android versions
without needing manual flag overrides.
Issue: 490100851
Issue: 532404997