Oboe sometimes cannot play very short sounds
- Dominant language
- C++
- Stars
- 4.1k
- Forks
- 639
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 8
Description
Some apps play short sounds, eg. 30 msec, by opening a file, playing the sound and then stopping the stream.
In some cases the sound may never be heard.
One part of the problem may be here:
[src/opensles/AudioStreamOpenSLES.cpp#L407](https://www.google.com/url?q=https://github.com/google/oboe/blob/854e0d4ecb1f49cb84af41820182a6ef267e71f4/src/opensles/AudioStreamOpenSLES.cpp%23L407&sa=D&source=buganizer&usg=AOvVaw1w-iIFlM7EOe8VCYfvyPyq)
When the app callback returns DataCallbackResult::Stop, Oboe does not queue the data from that callback to OpenSL ES.
Also the Oboe requestStop() method flushes/clears the queue of any unplayed data.
The comment says it is "so the old data won't be played if the stream is restarted."
Maybe we should just clear the queue when we restart the stream instead.
We should add a "Short Sound" test in OboeTester to experiment with these various techniques.
We could tag buffers with varying frequency sinewaves that fit an exact number of cycles within the buffer.
Then we could use loopback analysis to identify which buffers get played and which get dropped.
Contributor guide
Assessment
This issue has not been assessed yet.