From 5e0c851c0f4ea1e8ed7528f40bf04655fa4eead2 Mon Sep 17 00:00:00 2001 From: Toliver Jue Date: Tue, 17 Sep 2024 08:26:31 +0900 Subject: [PATCH] server: Use OS-generated temp file name for ffmpeg converted files --- examples/server/server.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 02921763d5c..60b96d497e6 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -677,7 +677,8 @@ int main(int argc, char ** argv) { if (sparams.ffmpeg_converter) { // if file is not wav, convert to wav // write to temporary file - const std::string temp_filename = "whisper_server_temp_file.wav"; + const std::string temp_filename_base = std::tmpnam(nullptr); + const std::string temp_filename = temp_filename_base + ".wav"; std::ofstream temp_file{temp_filename, std::ios::binary}; temp_file << audio_file.content; temp_file.close();