Spaces:
Running
Running
server : use OS-generated temp file name for converted files (#2419)
Browse files
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
|
|
|
|
| 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();
|