void RemixAndResample(InterleavedView<const int16_t> src_data,
int sample_rate_hz,
PushResampler<int16_t>* resampler,
AudioFrame* dst_frame) { // The `samples_per_channel_` members must have been set correctly based on // the associated sample rate and the assumed 10ms buffer size. // TODO(tommi): Remove the `sample_rate_hz` param.
RTC_DCHECK_EQ(SampleRateToDefaultChannelSize(sample_rate_hz),
src_data.samples_per_channel());
RTC_DCHECK_EQ(SampleRateToDefaultChannelSize(dst_frame->sample_rate_hz_),
dst_frame->samples_per_channel());
// Temporary buffer in case downmixing is required.
std::array<int16_t, AudioFrame::kMaxDataSizeSamples> downmixed_audio;
// TODO(yujo): for muted input frames, don't resample. Either 1) allow // resampler to return output length without doing the resample, so we know // how much to zero here; or 2) make resampler accept a hint that the input is // zeroed.
// Stash away the originally requested number of channels. Then provide // `dst_frame` as a target buffer with the same number of channels as the // source. auto original_dst_number_of_channels = dst_frame->num_channels_;
resampler->Resample(src_data,
dst_frame->mutable_data(dst_frame->samples_per_channel_,
src_data.num_channels()));
// Upmix after resampling.
if (src_data.num_channels() == 1 && original_dst_number_of_channels == 2) { // The audio in dst_frame really is mono at this point; MonoToStereo will // set this back to stereo.
RTC_DCHECK_EQ(dst_frame->num_channels_, 1);
AudioFrameOperations::UpmixChannels(2, dst_frame);
}
}
} // namespace voe
} // namespace webrtc
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet am 2026-08-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.