This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
Fixing almost infinity loop in FillSilence for wrong bytes length #195
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.
In reaction on my issue #175, I found fix:
During debugging reason of app crashing during another load of manifest when audio from previous manifest hasn't start playing, I found out that
time = player_->CurrentTime()
is returning 0.Later function GetSyncBytes returns wrong big number, because
(buffer_end - next->pts)
inGetSyncBytes
is deducting:0 - SECONDS.
This cause that function FillSilence in audio_renderer_common start to loop on huge bytes size and ends almost in infinity loop. Results is app crash on device or memory pressure on simulator like it was described in issue #175.
I think that after
clock_->SleepSeconds(delay)
there should be check on player status in same way as on each thread loop start. Additionally, there has to bestd::unique_lock<Mutex> lock(mutex_)
to lock mutex which was unlocked before sleep.If there is no check,
time = player_->CurrentTime()
returns 0 after sleep in specific situation.Fixes #175