Skip to content

Commit

Permalink
fix webrtc resampler in interface
Browse files Browse the repository at this point in the history
  • Loading branch information
z-dule committed Oct 29, 2024
1 parent eb7bd60 commit 49fb03d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/audio_effect/pcm_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ int apply_effect_to_pcm(const char* pcmIn,
return -1;
}

webrtc::PushResampler<int16_t> input_resampler(fs_hz, FS_PROC, 1);
webrtc::PushResampler<int16_t> output_resampler(FS_PROC, fs_hz, 1);

// Setup Audio Buffer used by apm
webrtc::AudioFrame near_frame;
Expand Down Expand Up @@ -205,6 +203,10 @@ int apply_effect_to_pcm(const char* pcmIn,
int16_t bufIn[L], procOut[L_proc];
//int16_t procIn[L_proc], procOut[L_proc];
size_t count;

webrtc::PushResampler<int16_t> input_resampler(L, L_proc, 1);
webrtc::PushResampler<int16_t> output_resampler(L_proc, L, 1);

for(int i = 0; i < n_frames; i++){
count = fread(bufIn,
sizeof(int16_t),
Expand Down
7 changes: 4 additions & 3 deletions src/audio_effect/wav_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,6 @@ int apply_effect_to_wav(const char* wavIn,
int progress = 0;
int rem = 0;
int n_samp_out = 0;

webrtc::PushResampler<int16_t> input_resampler(format.sample_rate, FS_PROC, 1);
webrtc::PushResampler<int16_t> output_resampler(FS_PROC, format.sample_rate, 1);

// Setup Audio Buffer used by apm
webrtc::AudioFrame near_frame;
Expand Down Expand Up @@ -398,6 +395,10 @@ int apply_effect_to_wav(const char* wavIn,
int16_t bufIn[L];
int16_t procIn[L_proc], procOut[L_proc];
size_t count;

webrtc::PushResampler<int16_t> input_resampler(L, L_proc, 1);
webrtc::PushResampler<int16_t> output_resampler(L_proc, L, 1);

for(int i = 0; i < N; i++){
count = fread(bufIn,
sizeof(int16_t),
Expand Down

0 comments on commit 49fb03d

Please sign in to comment.