]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
server : use OS-generated temp file name for converted files (#2419)
authorToliver <redacted>
Tue, 17 Sep 2024 12:56:32 +0000 (21:56 +0900)
committerGitHub <redacted>
Tue, 17 Sep 2024 12:56:32 +0000 (15:56 +0300)
examples/server/server.cpp

index 02921763d5c5c33650574838bd32a126f75b7f90..60b96d497e667a8353ce912e6ac665c759d9efdb 100644 (file)
@@ -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();