mirror of
https://github.com/linuxdeepin/deepin-music.git
synced 2026-10-16 21:20:47 +08:00
a82c24ec85
1. Root cause: onBufferDetector() set m_stopFlag on a running thread but never called wait(); start() on a running QThread is a no-op so the new track's waveform detection never launched; the old thread's exit path also cleared m_curPath/m_curHash, overwriting the new track metadata just set by onBufferDetector() 2. Fix: introduce QMutex-protected request generation counter and pending-request queue; new requests arriving while the worker is running are queued and started via QThread::finished signal; stale thread results are discarded by generation check in resample and forwardAudioBuffer; QML side also filters stale buffers by hash 3. Impact: public audioBuffer signal and slot signatures unchanged; AudioAnalysis and all existing callers unaffected; new concurrency test covers the race scenario Log: fix waveform progress bar anomaly on track switch Influence: 1. Test waveform display when rapidly switching tracks 2. Test waveform display when playing from album page 3. Verify no stale waveform data after track switch fix: 修复切歌时波形进度条状态异常 1. 根因:onBufferDetector() 在检测线程运行时仅设置 m_stopFlag 但未 调用 wait() 等待线程退出,对运行中的线程调用 start() 是空操作导致 新歌曲波形检测无法启动;旧线程退出时 clear m_curPath/m_curHash 覆盖刚设置的新歌曲信息 2. 方案:引入 QMutex 保护的请求代际计数器和待处理请求队列;新请求在 工作线程运行时排队,通过 QThread::finished 信号启动;resample 和 forwardAudioBuffer 中通过代际检查丢弃过期结果;QML 侧通过 hash 比较过滤过期波形数据 3. 影响:公开 audioBuffer 信号和槽签名未变,AudioAnalysis 及所有现有 调用方不受影响;新增竞态测试覆盖切歌场景 Log: 修复切歌时波形进度条状态异常 Influence: 1. 测试快速切歌时的波形显示 2. 测试从专辑页面播放时的波形显示 3. 验证切歌后无过期波形数据残留 PMS: BUG-378709