teejae commited on
Commit
04d9c8d
·
unverified ·
1 Parent(s): dafe96d

server : use OS-generated temp file name for converted files (#2419)

Browse files
Files changed (1) hide show
  1. examples/server/server.cpp +2 -1
examples/server/server.cpp CHANGED
@@ -677,7 +677,8 @@ int main(int argc, char ** argv) {
677
  if (sparams.ffmpeg_converter) {
678
  // if file is not wav, convert to wav
679
  // write to temporary file
680
- const std::string temp_filename = "whisper_server_temp_file.wav";
 
681
  std::ofstream temp_file{temp_filename, std::ios::binary};
682
  temp_file << audio_file.content;
683
  temp_file.close();
 
677
  if (sparams.ffmpeg_converter) {
678
  // if file is not wav, convert to wav
679
  // write to temporary file
680
+ const std::string temp_filename_base = std::tmpnam(nullptr);
681
+ const std::string temp_filename = temp_filename_base + ".wav";
682
  std::ofstream temp_file{temp_filename, std::ios::binary};
683
  temp_file << audio_file.content;
684
  temp_file.close();