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) in GetSyncBytes 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 be std::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.
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