Optimize parameter passing to avoid unnecessary copying

This commit is contained in:
Pugemon 2024-06-07 03:58:20 +03:00
parent 46ca1bb04a
commit f25a425cb9
123 changed files with 578 additions and 522 deletions

View file

@ -80,7 +80,7 @@ class OggStream : public PCMStream {
size_t totalSamples = 0;
bool seekable;
public:
OggStream(OggVorbis_File vf) : vf(std::move(vf)) {
OggStream(OggVorbis_File vf) : vf(vf) {
vorbis_info* info = ov_info(&vf, -1);
channels = info->channels;
sampleRate = info->rate;
@ -158,5 +158,5 @@ std::unique_ptr<PCMStream> ogg::create_stream(const fs::path& file) {
if ((code = ov_fopen(file.u8string().c_str(), &vf))) {
throw std::runtime_error("vorbis: "+vorbis_error_message(code));
}
return std::make_unique<OggStream>(std::move(vf));
return std::make_unique<OggStream>(vf);
}