three.js 做的网站,威海做网站公司,天津营销网站建设公司排名,app软件系统开发webrtc遇到困扰#xff1a;
如果msvc编译#xff0c;ffmpeg编译失败#xff0c;需要替换ffmpeg库。如果用clang编译#xff0c;vs或qt调用dll又存在崩溃。 经过反复尝试找到解决方法#xff1a;
一、编译
1、编译参数
//我得环境配置
set DEPOT_TOOLS_UPDATE0
set DEP…webrtc遇到困扰
如果msvc编译ffmpeg编译失败需要替换ffmpeg库。如果用clang编译vs或qt调用dll又存在崩溃。 经过反复尝试找到解决方法
一、编译
1、编译参数
//我得环境配置
set DEPOT_TOOLS_UPDATE0
set DEPOT_TOOLS_WIN_TOOLCHAIN0
set GYP_MSVS_VERSION2022
set GYP_MSVS_OVERRIDE_PATH C:\Program Files (x86)\Microsoft Visual Studio 14.0
set GYP_GENERATORSmsvs-ninja,ninja//x86 release
gn gen out\x86_release_clang --idevs2022 --argsuse_rttitrue is_debugfalse target_cpu\x86\ is_component_ffmpegtrue ffmpeg_branding\Chrome\ proprietary_codecstrue rtc_use_h264true gtest_enable_absl_printersfalse libyuv_include_testsfalse rtc_enable_protobuffalse treat_warnings_as_errorsfalse use_custom_libcxxfalse//x86 debug
gn gen out\x86_debug_clang --idevs2022 --argsuse_rttitrue is_debugtrue target_cpu\x86\ is_component_ffmpegtrue ffmpeg_branding\Chrome\ proprietary_codecstrue rtc_use_h264true gtest_enable_absl_printersfalse libyuv_include_testsfalse rtc_enable_protobuffalse treat_warnings_as_errorsfalse enable_iterator_debuggingtrue use_custom_libcxxfalse rtc_enable_avx2false
生成sln后在vs内编译。 生成jsoncpp,进入到生成目录内
lib *.obj /out:jsoncpp.lib2、编译webrtc生成libwebrtc库。
2、使用
vs2022 创建dll举例测试apm 选llvmc17标准 多线程MTD 预处理器这一大堆是比较麻烦的怎么办 找到 src\out\x86_debug_clang\obj\pc 下面的peer_connection.vcxproj用记事本打开复制
PreprocessorDefinitionsUSE_AURA1;_HAS_NODISCARD;_CRT_NONSTDC_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;CR_CLANG_REVISIONquot;llvmorg-18-init-4631-gd50b56d1-1quot;;_HAS_EXCEPTIONS0;__STD_C;_CRT_RAND_S;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_ATL_NO_OPENGL;_WINDOWS;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;PSAPI_VERSION2;WIN32;_SECURE_ATL;WINAPI_FAMILYWINAPI_FAMILY_DESKTOP_APP;WIN32_LEAN_AND_MEAN;NOMINMAX;_UNICODE;UNICODE;NTDDI_VERSIONNTDDI_WIN10_NI;_WIN32_WINNT0x0A00;WINVER0x0A00;_DEBUG;DYNAMIC_ANNOTATIONS_ENABLED1;WEBRTC_ENABLE_PROTOBUF0;WEBRTC_STRICT_FIELD_TRIALS0;WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE;RTC_ENABLE_VP9;RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY;WEBRTC_HAVE_SCTP;WEBRTC_USE_H264;WEBRTC_LIBRARY_IMPL;RTC_ENABLE_WIN_WGC;WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS1;WEBRTC_WIN;ABSL_ALLOCATOR_NOTHROW1;_ENABLE_EXTENDED_ALIGNED_STORAGE;LIBYUV_DISABLE_NEON;%(PreprocessorDefinitions)/PreprocessorDefinitions这个是连接器输入
比较重要的对clang的附加选项限制 这个找到 src\out\x86_debug_clang\obj\pc 下面的peer_connection.vcxproj AdditionalOptions-Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-nonportable-include-path -Wenum-compare-conditional -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wno-deprecated-this-capture -Wshadow -fno-delete-null-pointer-checks -fno-ident -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare0 /clang:-ffp-contractoff -fcomplete-member-pointers /Gy /FS /bigobj /utf-8 /Zc:twoPhase -ffile-reproducible /Zc:sizedDealloc- /D__WRL_ENABLE_FUNCTION_STATICS__ -fmsc-version1934 -m32 -msse3 /Brepro -Wno-builtin-macro-redefined -D__DATE__ -D__TIME__ -D__TIMESTAMP__ -ffile-compilation-dir. -no-canonical-prefixes /std:c11 -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare /std:c17 -Wno-trigraphs -ftrivial-auto-var-initpattern /Ob0 /GF /Z7 -gno-codeview-command-line -gcodeview-ghash -Xclang -fuse-ctor-homing /guard:cf,nochecks -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -Wglobal-constructors -Wno-shadow -Wctad-maybe-unsupported -Wc11-narrowing -Wundef -Wunused-lambda-capture %(AdditionalOptions)/AdditionalOptions在这里面封装好的库就可以在msvc里调用了。
如果还有问题可能是llvm的版本有问题需要在dll工程的同目录下创建Directory.build.props 文件记事本打开编辑
ProjectPropertyGroupLLVMInstallDirG:\webrtc20230919\src\third_party\llvm-build\ReleaseAsserts/LLVMInstallDirLLVMToolsVersion18/LLVMToolsVersion/PropertyGroup
/Project这里是指定llvm应用版本制定的和webrtc用同一个。