Skip to content

Commit

Permalink
fix(filteraudiorender): calculate the out frame nb_samples
Browse files Browse the repository at this point in the history
todo: splite the speed filter from the whole filter, and
calculate the mSpeedDeltaDuration on speed filter only

Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai committed Sep 17, 2020
1 parent fe77c6c commit ba126a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion framework/render/audio/filterAudioRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ namespace Cicada {
AF_LOGE("subInit failed , ret = %d ", ret);
return ret;
}
if (mOutputInfo.nb_samples > 0) {
float rate = (float) mInputInfo.sample_rate / mOutputInfo.sample_rate;
float nb_samples = mOutputInfo.nb_samples /= rate;
mOutputInfo.nb_samples = nb_samples;
}

if (needFilter) {
mFilter = std::unique_ptr<IAudioFilter>(filterFactory::createAudioFilter(mInputInfo, mOutputInfo, mUseActiveFilter));
Expand Down Expand Up @@ -82,7 +87,8 @@ namespace Cicada {
}

if (mOutputInfo.nb_samples == 0) {
mOutputInfo.nb_samples = frame->getInfo().audio.nb_samples;
float rate = mInputInfo.sample_rate / mOutputInfo.sample_rate;
mOutputInfo.nb_samples = frame->getInfo().audio.nb_samples / rate;
}

mFrameQue.push(move(frame));
Expand Down

0 comments on commit ba126a9

Please sign in to comment.