Skip to content

Commit

Permalink
perf(filteraudiorender): fix busy loop
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai authored and I-m-SuperMan committed Jul 31, 2020
1 parent 6ba6696 commit cd53dd3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions framework/render/audio/filterAudioRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ namespace Cicada {
if (mRenderFrame == nullptr) {
mRenderFrame = getFrame();
}
int ret = 0;

while (mRenderFrame != nullptr) {
if (mState != State::state_running) {
Expand All @@ -236,7 +237,7 @@ namespace Cicada {

loopChecker();
int nb_samples = mRenderFrame->getInfo().audio.nb_samples;
int ret = device_write(mRenderFrame);
ret = device_write(mRenderFrame);

if (ret == -EAGAIN) {

Expand All @@ -250,7 +251,7 @@ namespace Cicada {
}
mRenderFrame = getFrame();
}
if (mFrameQue.empty()) {
if (mFrameQue.empty() || ret == -EAGAIN) {

// TODO: only on Android xiaomi miui 9?
mMaxQueSize = std::min(mMaxQueSize.load() + 1, MAX_INPUT_BUFFER_COUNT);
Expand Down

0 comments on commit cd53dd3

Please sign in to comment.