From faaf9460b132636e5d39a0ab3593d38371c2e2f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Tue, 10 Oct 2023 14:03:34 -0400
Subject: [PATCH] audiofile, resampler: cleanup

Change-Id: I33d2b5575afc78df2fd35b03e197b5d59a3a0bf7
---
 src/media/audio/resampler.cpp       | 8 +++-----
 src/media/audio/sound/audiofile.cpp | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/media/audio/resampler.cpp b/src/media/audio/resampler.cpp
index a5770782d9..dd43bbaf84 100644
--- a/src/media/audio/resampler.cpp
+++ b/src/media/audio/resampler.cpp
@@ -125,15 +125,13 @@ Resampler::resample(const AVFrame* input, AVFrame* output)
         // indicative of an underlying problem in the code. This check is so the backtrace
         // doesn't get mangled with a bunch of calls to Resampler::resample
         if (initCount_ > 1) {
-            std::string msg = "Infinite loop detected in audio resampler, please open an issue on "
-                              "https://git.jami.net";
-            JAMI_ERR() << msg;
-            throw std::runtime_error(msg);
+            JAMI_ERROR("Infinite loop detected in audio resampler, please open an issue on https://git.jami.net");
+            throw std::runtime_error("Resampler");
         }
         reinit(input, output);
         return resample(input, output);
     } else if (ret < 0) {
-        JAMI_ERR() << "Failed to resample frame";
+        JAMI_ERROR("Failed to resample frame");
         return -1;
     }
 
diff --git a/src/media/audio/sound/audiofile.cpp b/src/media/audio/sound/audiofile.cpp
index f754f87b18..fba2906e7c 100644
--- a/src/media/audio/sound/audiofile.cpp
+++ b/src/media/audio/sound/audiofile.cpp
@@ -66,7 +66,7 @@ AudioFile::AudioFile(const std::string& fileName, unsigned int sampleRate, AVSam
     Resampler r {};
     auto decoder = std::make_unique<MediaDecoder>(
         [&r, this, &buf, &total_samples](const std::shared_ptr<MediaFrame>& frame) mutable {
-            auto resampled = r.resample(std::move(std::static_pointer_cast<AudioFrame>(frame)), format_);
+            auto resampled = r.resample(std::static_pointer_cast<AudioFrame>(frame), format_);
             total_samples += resampled->getFrameSize();
             buf.emplace_back(std::move(resampled));
         });
-- 
GitLab