Skip to content
Snippets Groups Projects
Commit 5028c30b authored by Adrien Béraud's avatar Adrien Béraud
Browse files

audiofile: count samples with resampled format

Change-Id: I451c66a9b9a8f806daa82406ca24936d4345b068
parent ce188250
No related branches found
No related tags found
No related merge requests found
...@@ -66,9 +66,9 @@ AudioFile::AudioFile(const std::string& fileName, unsigned int sampleRate, AVSam ...@@ -66,9 +66,9 @@ AudioFile::AudioFile(const std::string& fileName, unsigned int sampleRate, AVSam
Resampler r {}; Resampler r {};
auto decoder = std::make_unique<MediaDecoder>( auto decoder = std::make_unique<MediaDecoder>(
[&r, this, &buf, &total_samples](const std::shared_ptr<MediaFrame>& frame) mutable { [&r, this, &buf, &total_samples](const std::shared_ptr<MediaFrame>& frame) mutable {
auto autoFrame = std::static_pointer_cast<AudioFrame>(frame); auto resampled = r.resample(std::move(std::static_pointer_cast<AudioFrame>(frame)), format_);
total_samples += autoFrame->getFrameSize(); total_samples += resampled->getFrameSize();
buf.emplace_back(r.resample(std::move(autoFrame), format_)); buf.emplace_back(std::move(resampled));
}); });
DeviceParams dev; DeviceParams dev;
dev.input = fileName; dev.input = fileName;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment