[4.7.3] Fix auto switch to System default#33569
Conversation
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThis pull request refactors the audio driver configuration and device fallback mechanisms. Buffer size constants are redefined as platform-dependent MINIMUM_BUFFER_SIZE and MAXIMUM_BUFFER_SIZE. A new 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/framework/audio/main/internal/audiodrivercontroller.cpp (1)
218-230:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDo not persist API switch when driver open fails.
When
open()fails, this path still setscurrentAudioApiand notifies listeners. That can leave config/UI claiming the new API is active while no driver was opened.Proposed diff
- if (m_audioDriver && !m_audioDriver->defaultDevice().empty()) { + bool ok = false; + if (m_audioDriver && !m_audioDriver->defaultDevice().empty()) { spec.deviceId = DEFAULT_DEVICE_ID; - bool ok = m_audioDriver->open(spec, nullptr); + ok = m_audioDriver->open(spec, nullptr); if (!ok) { LOGE() << "Failed to open audio driver: " << name; } } else { LOGW() << "No devices for " << name; } - configuration()->setCurrentAudioApi(name); - m_currentAudioApiChanged.notify(); + if (ok) { + configuration()->setCurrentAudioApi(name); + m_currentAudioApiChanged.notify(); + } m_availableOutputDevicesChanged.notify();
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/framework/audio/main/internal/audioconfiguration.cpp`:
- Around line 179-186: defaultOutputSpec() hardcodes sampleRate,
samplesPerChannel and audioChannelCount leading to duplicated literals; update
OutputSpec AudioConfiguration::defaultOutputSpec() to derive values from the
existing defaults instead: set spec.sampleRate from AUDIO_SAMPLE_RATE_KEY (or
the function that returns its default), set spec.samplesPerChannel from
AUDIO_BUFFER_SIZE_KEY, and set spec.audioChannelCount via audioChannelsCount()
(or fall back to AUDIO_CHANNELS) so the function uses the single source-of-truth
constants/queries already present in this file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: b99b9e1b-a4b8-406c-9bcf-a652923ef672
📒 Files selected for processing (7)
src/framework/audio/common/audiotypes.hsrc/framework/audio/driver/platform/win/asio/asioaudiodriver.cppsrc/framework/audio/main/iaudioconfiguration.hsrc/framework/audio/main/internal/audioconfiguration.cppsrc/framework/audio/main/internal/audioconfiguration.hsrc/framework/audio/main/internal/audiodrivercontroller.cppsrc/framework/audio/main/internal/audiodrivercontroller.h
💤 Files with no reviewable changes (1)
- src/framework/audio/common/audiotypes.h
* ASIO reset() now fires availableOutputDevicesChanged instead of self-handling close/reopen, matching the WASAPI behavior * AudioDriverController::checkOutputDevice() falls back to the default audio driver (WASAPI) if reopen fails
6b4c13e to
77b6550
Compare
Resolves: #33224