SFTtech / SFTtech/openage

audio::DynamicResource chunk reusage incorrect

Open
#1,265 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug lang: c++
Dominant language
Python
Stars
14.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

libopenage/audio/dynamic_resource.h
This class defines a hashmap and a queue to maintain the audio chunks.

datastructure::ConcurrentQueue<std::shared_ptr<chunk_info_t>> decay_queue;
std::unordered_map<size_t,std::shared_ptr<chunk_info_t>> chunks;

Both of them keep a pointer to the actual chunk. However, when a chunk is recycled from the queue, there is no way to invalidate the pointer in chunks. Thus the same chunk can still be found with an outdated index, but it may contain incorrect audio data.

I think the queue should keep indexes of the hashmap, not pointers to the chunks (which are values of the hashmap).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libopenage/audio/dynamic_resource.h and inspect the DynamicResource class, especially decay_queue and chunks. Trace how chunks are added, recycled, and looked up to confirm when an outdated index can return incorrect audio data. Done means recycled chunks can no longer be found through stale hashmap entries while chunk reuse remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.