#64 の修正後、 SoraAudioSink.read() の実行タイミングによってはクラッシュが発生するようになった問題の対応 #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
変更内容
#64 の修正後に、 SoraAudioSink.read() の実行タイミングによってクラッシュが発生するようになりました
num_of_samples を計算する位置と、 std::condition_variable::wait_for の完了条件を修正して、問題のクラッシュが発生しないようになることを確認しました
再現コード
This pull request primarily addresses a bug in the
SoraAudioSink.read
function in thesrc/sora_audio_sink.cpp
file, as well as updates theCHANGES.md
file to reflect these changes. The bug fix ensures that the function does not ignore timeouts and prevents crashes depending on the timing of the read operation.Bug fix in
SoraAudioSink.read
:src/sora_audio_sink.cpp
: In theSoraAudioSinkImpl::Read
function, the calculation ofnum_of_samples
has been moved to after the conditional wait to account for possible updates tonumber_of_channels_
during the wait. The condition for the wait has also been updated to check thatnumber_of_channels_
is greater than 0 before comparing the buffer size with the number of samples. [1] [2]Updates to
CHANGES.md
:CHANGES.md
: The fix description forSoraAudioSink.read
has been updated to reflect the changes made to address the bug.