From 7c2a5d0be76132e9b1e8e5e7e9ec8e1916445613 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 10 Sep 2026 01:34:17 +0300 Subject: [PATCH] [mod_sndfile] Windows: update libsndfile to v1.2.2 from GitHub. Add test_sndfile visual studio project to the solution. (#3155) --- .gitignore | 4 + Freeswitch.2017.sln | 19 ++ src/mod/formats/mod_sndfile/test/GitInfo | 0 .../test/test_sndfile.2017.vcxproj | 203 ++++++++++++++++++ .../formats/mod_sndfile/test/test_sndfile.c | 26 ++- w32/libsndfile-version.props | 2 +- w32/libsndfile.props | 52 ++--- 7 files changed, 275 insertions(+), 31 deletions(-) create mode 100644 src/mod/formats/mod_sndfile/test/GitInfo create mode 100644 src/mod/formats/mod_sndfile/test/test_sndfile.2017.vcxproj diff --git a/.gitignore b/.gitignore index 1b9dcb1551..d8bafdb3bd 100644 --- a/.gitignore +++ b/.gitignore @@ -268,6 +268,10 @@ src/mod/applications/mod_http_cache/test/test_aws.log src/mod/applications/mod_http_cache/test/test_aws.trs src/mod/formats/mod_sndfile/test/test_sndfile src/mod/formats/mod_sndfile/test/test_sndfile_conf +# Recordings test_sndfile writes here on Windows, named .. A passing run +# unlinks them, but libsndfile also writes a ._.sd2 resource fork that nothing +# removes, and a failing run leaves the lot behind. +src/mod/formats/mod_sndfile/test/*-*-*-*-* src/mod/*/*/test/*.log src/mod/*/*/test/*.trs src/mod/*/*/test/[0-9]*/* diff --git a/Freeswitch.2017.sln b/Freeswitch.2017.sln index 5efcf1dd3a..2cbc4833f8 100644 --- a/Freeswitch.2017.sln +++ b/Freeswitch.2017.sln @@ -516,6 +516,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_test", "src\mod\applica EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_switch_xml", "tests\unit\test_switch_xml.2017.vcxproj", "{FED39CFF-E6CD-1C09-844D-F1174B8A5C18}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_sndfile", "src\mod\formats\mod_sndfile\test\test_sndfile.2017.vcxproj", "{19D12A4C-1036-4695-85B0-6030F6048233}" + ProjectSection(ProjectDependencies) = postProject + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6} = {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6} + {B3F424EC-3D8F-417C-B244-3919D5E1A577} = {B3F424EC-3D8F-417C-B244-3919D5E1A577} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2300,6 +2306,18 @@ Global {FED39CFF-E6CD-1C09-844D-F1174B8A5C18}.Release|Win32.Build.0 = Release|Win32 {FED39CFF-E6CD-1C09-844D-F1174B8A5C18}.Release|x64.ActiveCfg = Release|x64 {FED39CFF-E6CD-1C09-844D-F1174B8A5C18}.Release|x64.Build.0 = Release|x64 + {19D12A4C-1036-4695-85B0-6030F6048233}.All|Win32.ActiveCfg = Debug|Win32 + {19D12A4C-1036-4695-85B0-6030F6048233}.All|Win32.Build.0 = Debug|Win32 + {19D12A4C-1036-4695-85B0-6030F6048233}.All|x64.ActiveCfg = Debug|x64 + {19D12A4C-1036-4695-85B0-6030F6048233}.All|x64.Build.0 = Debug|x64 + {19D12A4C-1036-4695-85B0-6030F6048233}.Debug|Win32.ActiveCfg = Debug|Win32 + {19D12A4C-1036-4695-85B0-6030F6048233}.Debug|Win32.Build.0 = Debug|Win32 + {19D12A4C-1036-4695-85B0-6030F6048233}.Debug|x64.ActiveCfg = Debug|x64 + {19D12A4C-1036-4695-85B0-6030F6048233}.Debug|x64.Build.0 = Debug|x64 + {19D12A4C-1036-4695-85B0-6030F6048233}.Release|Win32.ActiveCfg = Release|Win32 + {19D12A4C-1036-4695-85B0-6030F6048233}.Release|Win32.Build.0 = Release|Win32 + {19D12A4C-1036-4695-85B0-6030F6048233}.Release|x64.ActiveCfg = Release|x64 + {19D12A4C-1036-4695-85B0-6030F6048233}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2480,6 +2498,7 @@ Global {3745B86B-6BE8-3E67-FCB9-BE62A6131D67} = {9388C266-C3FC-468A-92EF-0CBC35941412} {E9FF8127-D5F0-2398-59EB-702CE55F7800} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {FED39CFF-E6CD-1C09-844D-F1174B8A5C18} = {9388C266-C3FC-468A-92EF-0CBC35941412} + {19D12A4C-1036-4695-85B0-6030F6048233} = {9388C266-C3FC-468A-92EF-0CBC35941412} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {09840DE7-9208-45AA-9667-1A71EE93BD1E} diff --git a/src/mod/formats/mod_sndfile/test/GitInfo b/src/mod/formats/mod_sndfile/test/GitInfo new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/formats/mod_sndfile/test/test_sndfile.2017.vcxproj b/src/mod/formats/mod_sndfile/test/test_sndfile.2017.vcxproj new file mode 100644 index 0000000000..2bc16da062 --- /dev/null +++ b/src/mod/formats/mod_sndfile/test/test_sndfile.2017.vcxproj @@ -0,0 +1,203 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + test_sndfile + test_sndfile + Win32Proj + 10.0 + {19D12A4C-1036-4695-85B0-6030F6048233} + + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + Application + MultiByte + $(DefaultPlatformToolset) + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + false + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + $(SolutionDir)$(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + $(SolutionDir)src\include;%(AdditionalIncludeDirectories) + SWITCH_TEST_BASE_DIR_FOR_CONF="..\\..\\src\\mod\\formats\\mod_sndfile\\test\\";%(PreprocessorDefinitions) + + + + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + true + Console + true + + + MachineX86 + + + + + + X64 + + + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + true + Console + true + + + MachineX64 + + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level4 + ProgramDatabase + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + false + Console + true + true + true + + + MachineX86 + + + + + + X64 + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level4 + ProgramDatabase + 6031;6340;6246;6011;6387;%(DisableSpecificWarnings) + + + $(OutDir);%(AdditionalLibraryDirectories) + false + Console + true + true + true + + + MachineX64 + + + + + + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + + + + + + \ No newline at end of file diff --git a/src/mod/formats/mod_sndfile/test/test_sndfile.c b/src/mod/formats/mod_sndfile/test/test_sndfile.c index 8a6d790207..ce01b18ec8 100644 --- a/src/mod/formats/mod_sndfile/test/test_sndfile.c +++ b/src/mod/formats/mod_sndfile/test/test_sndfile.c @@ -109,6 +109,24 @@ typedef struct { #define thread_bail_out(x, msg) if (!(x)) {params->status = SWITCH_STATUS_FALSE; params->err_detail = strdup(msg); return NULL;} +/* Where to write the recording this test makes and reads back. */ +static char *test_recording_path(switch_core_session_t *session, const char *ext) +{ +#ifdef WIN32 + /* Windows has no /tmp, so record into the test folder, which is conf_dir's parent. + * Anchor it on base_dir to keep it absolute: conf_dir on its own is relative, and + * switch_is_file_path() only accepts a drive letter, a leading separator or a URL. + * A path it rejects makes switch_ivr_record_session() prepend sound_prefix to the + * whole string - in front of the "{force_channels=2}" the stereo tests pass - which + * then defeats the brace stripping it does before creating the parent directory. */ + return switch_mprintf("%s%s%s%s..%s%s.%s", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR, + SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR, + switch_core_session_get_uuid(session), ext); +#else + return switch_mprintf("/tmp/%s.%s", switch_core_session_get_uuid(session), ext); +#endif +} + static void *SWITCH_THREAD_FUNC sndfile_write_read_mono_thread_run(switch_thread_t *thread, void *obj) { /* play mono, record mono, open mono */ @@ -136,7 +154,7 @@ static void *SWITCH_THREAD_FUNC sndfile_write_read_mono_thread_run(switch_thread switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Testing media file extension: [%s]\n", params->ext); - recording = switch_mprintf("/tmp/%s.%s", switch_core_session_get_uuid(session), params->ext); + recording = test_recording_path(session, params->ext); status = switch_ivr_record_session(session, recording, duration, NULL); thread_bail_out(status == SWITCH_STATUS_SUCCESS, "switch_ivr_record_session() status != SWITCH_STATUS_SUCCESS"); @@ -207,7 +225,7 @@ static void *SWITCH_THREAD_FUNC sndfile_write_read_m2s_thread_run(switch_thread_ status = switch_ivr_originate(NULL, &session, &cause, "null/+15553334444", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); thread_bail_out(status == SWITCH_STATUS_SUCCESS, "switch_ivr_originate() status != SWITCH_STATUS_SUCCESS"); - recording = switch_mprintf("/tmp/%s.%s", switch_core_session_get_uuid(session), params->ext); + recording = test_recording_path(session, params->ext); status = switch_ivr_record_session(session, recording, duration, NULL); thread_bail_out(status == SWITCH_STATUS_SUCCESS, "switch_ivr_record_session() status != SWITCH_STATUS_SUCCESS"); @@ -278,7 +296,7 @@ static void *SWITCH_THREAD_FUNC sndfile_write_read_s2m_thread_run(switch_thread_ status = switch_ivr_originate(NULL, &session, &cause, "null/+15553334444", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); thread_bail_out(status == SWITCH_STATUS_SUCCESS, "switch_ivr_originate() status != SWITCH_STATUS_SUCCESS"); - rec_path = switch_mprintf("/tmp/%s.%s", switch_core_session_get_uuid(session), params->ext); + rec_path = test_recording_path(session, params->ext); recording = switch_mprintf("{force_channels=2}%s", rec_path); channel = switch_core_session_get_channel(session); @@ -351,7 +369,7 @@ static void *SWITCH_THREAD_FUNC sndfile_write_read_stereo_thread_run(switch_thre status = switch_ivr_originate(NULL, &session, &cause, "null/+15553334444", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); thread_bail_out(status == SWITCH_STATUS_SUCCESS, "switch_ivr_play_file() status != SWITCH_STATUS_SUCCESS"); - rec_path = switch_mprintf("/tmp/%s.%s", switch_core_session_get_uuid(session), params->ext); + rec_path = test_recording_path(session, params->ext); recording = switch_mprintf("{force_channels=2}%s", rec_path); channel = switch_core_session_get_channel(session); diff --git a/w32/libsndfile-version.props b/w32/libsndfile-version.props index c30e080fef..753ba4a413 100644 --- a/w32/libsndfile-version.props +++ b/w32/libsndfile-version.props @@ -4,7 +4,7 @@ - 1.0.28.1.fda9c8d + 1.2.2 true diff --git a/w32/libsndfile.props b/w32/libsndfile.props index 03dbd5a9bd..26f1700a51 100644 --- a/w32/libsndfile.props +++ b/w32/libsndfile.props @@ -8,13 +8,13 @@ - - Debug - Release - - - $(BaseDir)libs\libsndfile-$(libsndfileVersion) + + win64 + win32 + $(BaseDir)libs\libsndfile-$(libsndfileVersion)-$(libsndfileArch) + https://github.com/libsndfile/libsndfile/releases/download/$(libsndfileVersion) - + + - - - - + + - + - - $(SolutionDir)libs\libsndfile-$(libsndfileVersion)\include;%(AdditionalIncludeDirectories) + $(libsndfileDir)\include;%(AdditionalIncludeDirectories) - $(SolutionDir)libs\libsndfile-$(libsndfileVersion)\binaries\$(Platform)\$(LibraryConfiguration)\lib;%(AdditionalLibraryDirectories) - libsndfile-1.lib;%(AdditionalDependencies) + $(libsndfileDir)\lib;%(AdditionalLibraryDirectories) + sndfile.lib;%(AdditionalDependencies) - \ No newline at end of file +