fix(camera): keep shutter audio stream active - #508
Conversation
Replace QSound with QSoundEffect for shutter playback. Keep a muted\nlooping effect active while shutter sound is enabled to prevent the\naudio backend from entering idle suspension.\n\n使用 QSoundEffect 播放快门音。快门音开启时保持静音循环音效运行,\n避免音频后端空闲挂起。\n\nLog: 修复快门音空闲后首次播放音量偏小的问题\nPMS: https://pms.uniontech.com/bug-view-369937.html\nInfluence: 关闭后重新开启或长时间未拍照后,首次快门声音量保持正常。
There was a problem hiding this comment.
Sorry @Resurgamz, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Reviewer's GuideReplaces QSound with QSoundEffect for shutter playback, adds a muted looping keepalive stream to keep the audio path active, introduces state-tracking for shutter sound enablement/pending playback, and wires the shutter sound setting changes through Settings/MainWindow into videowidget so they apply immediately. Sequence diagram for shutter sound playback with keepalive streamsequenceDiagram
actor User
participant videowidget
participant QSoundEffect_takePic as QSoundEffect_takePic
participant QSoundEffect_keepalive as QSoundEffect_keepalive
User->>videowidget: flash()
videowidget->>videowidget: get_sound_of_takeing_photo()
alt shutter_sound_enabled
alt keepalive_playing && takePic_ready
videowidget->>QSoundEffect_takePic: play()
else keepalive_not_ready
videowidget->>videowidget: m_shutterSoundPending = true
videowidget->>videowidget: ensureShutterSoundKeepalive()
videowidget->>QSoundEffect_keepalive: play()
end
end
QSoundEffect_takePic->>videowidget: statusChanged()
alt takePic_status == Error
videowidget->>videowidget: m_shutterSoundPending = false
else takePic_status == Ready
videowidget->>videowidget: playPendingShutterSound()
videowidget->>QSoundEffect_takePic: play()
end
QSoundEffect_keepalive->>videowidget: statusChanged()
alt keepalive_status == Error
videowidget->>videowidget: m_shutterSoundPending = false
else keepalive_status == Ready
videowidget->>videowidget: ensureShutterSoundKeepalive()
videowidget->>QSoundEffect_keepalive: play()
end
QSoundEffect_keepalive->>videowidget: playingChanged()
videowidget->>videowidget: ensureShutterSoundKeepalive()
videowidget->>videowidget: playPendingShutterSound()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 建议在应用失去焦点或进入空闲状态时优化keepalive资源占用
void videowidget::onApplicationStateChanged(Qt::ApplicationState state)
{
if (state != Qt::ApplicationActive) {
// 应用非活跃时停止keepalive以节省资源
if (m_shutterSoundKeepalive->isPlaying()) {
m_shutterSoundKeepalive->stop();
}
} else {
// 应用恢复活跃时重新确保keepalive
if (m_shutterSoundEnabled) {
ensureShutterSoundKeepalive();
}
}
} |
This reverts commit 89d4a4c.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Resurgamz The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Closing this PR because the continuous keepalive approach was reverted after power-impact evaluation. A lower-power on-demand warmup design will be proposed separately. |
Summary
Verification
PMS: https://pms.uniontech.com/bug-view-369937.html
Summary by Sourcery
Replace the camera shutter sound implementation with a QSoundEffect-based solution and keep a muted looping audio stream active to ensure reliable shutter playback when enabled.
New Features:
Bug Fixes:
Enhancements: