fix(SRP): crash when native OpenAL is unavailable - #195
Conversation
|
@cocos-robot run test cases |
Code Size Check Report
Interface Check ReportThis pull request does not change any public interfaces ! |
|
@troublemaker52025, Please check the result of
Task Details
|
|
@troublemaker52025, Please check the result of
Task Details |
There was a problem hiding this comment.
Pull request overview
Fixes a crash in the native AudioEngine PCM decode APIs (getPCMHeader / getOriginalPCMBuffer) when the OpenAL-backed AudioEngineImpl cannot be initialized, by introducing a decoder-only fallback path.
Changes:
- Adds a decoder-only initialization entrypoint (
AudioEngineImpl::initDecoder) and routes PCM decode APIs through a dedicatedgetDecoderImpl()selector. - Improves OpenAL initialization error handling/logging when device/context creation fails.
- Applies multiple formatting/comment cleanups across platform backends (oalsoft/apple/android).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| native/cocos/audio/oalsoft/AudioEngine-soft.h | Adds initDecoder() declaration; minor comment formatting. |
| native/cocos/audio/oalsoft/AudioEngine-soft.cpp | Implements initDecoder(), adds OpenAL init error checks/logs, and minor comment formatting. |
| native/cocos/audio/include/AudioEngine.h | Adds protected getDecoderImpl() strategy + decoder-only fallback member. |
| native/cocos/audio/AudioEngine.cpp | Implements sDecoderImpl, getDecoderImpl(), and routes PCM APIs through it. |
| native/cocos/audio/apple/AudioEngine-inl.mm | Adds AudioEngineImpl::initDecoder() stub for uniform compilation. |
| native/cocos/audio/apple/AudioEngine-inl.h | Declares initDecoder(); minor comment formatting. |
| native/cocos/audio/android/AudioEngine-inl.h | Declares initDecoder(); minor formatting. |
| native/cocos/audio/android/AudioEngine-inl.cpp | Adds initDecoder() stub; mostly formatting/indentation changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@cocos-robot run test cases |
|
@troublemaker52025, Please check the result of
Task Details |
|
@troublemaker52025, Please check the result of
Task Details |
|
@troublemaker52025, Please check the result of
Task Details
|
|
@troublemaker52025, Please check the result of
Task Details |
| CC_PLATFORM == CC_PLATFORM_LINUX || CC_PLATFORM == CC_PLATFORM_QNX | ||
| if (AudioEngine::sDecoderImpl == nullptr) { | ||
| AudioEngine::sDecoderImpl = ccnew AudioEngineImpl(); | ||
| AudioEngineImpl::initDecoder(); |
There was a problem hiding this comment.
Would it be better to make initDecoder() a non-static member function?
There was a problem hiding this comment.
I think keep static member function will be batter. Called independently without relying on a full OpenAL initialization
Co-authored-by: qiuguohua <qiuguohua111@126.com>
|
@troublemaker52025, Please check the result of
Task Details |
|
@troublemaker52025, Please check the result of
Task Details |
|
@troublemaker52025 ❗ There was an error during the execution of the tasks. Please check the logs for more details. |
Re: #
Changelog
sAudioEngineImpl = nullptr指针直接调用getPCMHeader()、getOriginalPCMBuffer()导致程序崩溃sAudioEngineImpl,无额外开销lazyInit()触发完整初始化,行为与改动前完全一致lazyInit()失败后降级到sDecoderImpl,PCM 解码依然正常Continuous Integration
This pull request:
Compatibility Check
This pull request: