Skip to content

Commit a9c56dc

Browse files
committed
fix(audio-util): case-insensitive extension comparison in resample_to_vio
1 parent 5885b6f commit a9c56dc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/libs/audio-util/src/Util.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <audio-util/Util.h>
22

3+
#include <cctype>
34
#include <iostream>
45
#include <memory>
56
#include <soxr.h>
@@ -11,7 +12,10 @@ namespace AudioUtil
1112
SF_VIO resample_to_vio(const std::filesystem::path &filepath, std::string &msg, const int tar_channel,
1213
const int tar_samplerate) {
1314
SF_VIO sf_vio_in;
14-
const std::string extension = filepath.extension().string();
15+
std::string extension = filepath.extension().string();
16+
for (auto &c : extension) {
17+
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
18+
}
1519

1620
// 处理不同格式的音频文件
1721
if (extension == ".wav") {

0 commit comments

Comments
 (0)