Qt重写webrtc的demo peerconnection

ops/2025/1/14 18:54:20/

整个demo为:

可以选择多个编码方式:

cmake_minimum_required(VERSION 3.5)project(untitled LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_INCLUDE_CURRENT_DIR ON)set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include_directories("D:/webrtc/webrtc-checkout/src""D:/webrtc/webrtc-checkout/src/out/release/obj""D:/webrtc/webrtc-checkout/src/third_party/abseil-cpp""D:/webrtc/webrtc-checkout/src/third_party/libyuv/include""D:/webrtc/webrtc-checkout/src/third_party/jsoncpp/source/include""D:/webrtc/webrtc-checkout/src/third_party/jsoncpp/generated"        
)
include_directories(./)
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
# They need to be set before the find_package(Qt5 ...) call.#if(ANDROID)
#    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
#    if (ANDROID_ABI STREQUAL "armeabi-v7a")
#        set(ANDROID_EXTRA_LIBS
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
#    endif()
#endif()
add_definitions(-D_ITERATOR_DEBUG_LEVEL=2-DUSE_AURA=1-DWEBRTC_USE_H264-D_HAS_EXCEPTIONS=0-D__STD_C-D_CRT_RAND_S-D_CRT_SECURE_NO_DEPRECATE-D_SCL_SECURE_NO_DEPRECATE-D_ATL_NO_OPENGL-D_WINDOWS-DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS-DPSAPI_VERSION=2-DWIN32-D_SECURE_ATL-DWINUWP-D__WRL_NO_DEFAULT_LIB__-DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP-DWIN10=_WIN32_WINNT_WIN10-DWIN32_LEAN_AND_MEAN-DNOMINMAX-D_UNICODE-DUNICODE-DNTDDI_VERSION=NTDDI_WIN10_RS2-D_WIN32_WINNT=0x0A00-DWINVER=0x0A00-DNDEBUG-DNVALGRIND-DDYNAMIC_ANNOTATIONS_ENABLED=0-DWEBRTC_ENABLE_PROTOBUF=0-DWEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE-DRTC_ENABLE_VP9-DHAVE_SCTP-DWEBRTC_LIBRARY_IMPL-DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0-DWEBRTC_WIN-DABSL_ALLOCATOR_NOTHROW=1-DQT_DEPRECATED_WARNINGS-DQT_NO_KEYWORDS-DHAVE_SCTP-DWEBRTC_VIDEO_CAPTURE_WINRT)
find_package(Qt5 COMPONENTS Widgets Network REQUIRED)
include_directories("D:/webrtc/webrtc-checkout/src/third_party/jsoncpp/source/install/include")
include_directories("D:/webrtc/webrtc-checkout/src/third_party/libyuv/include")
link_directories("D:/webrtc/webrtc-checkout/src/out/release/obj" "D:/webrtc/webrtc-checkout/src/third_party/jsoncpp/source/install/lib")
include_directories("D:/webrtc/webrtc-checkout/src/third_party/abseil-cpp/install/include")
add_executable(untitledmain.cpp conductor.cc defaults.cc peer_connection_client.cc  test_video_capturer.cc vcm_capturer.ccmainwindow.cpp D:/webrtc/webrtc-checkout/src/rtc_base/strings/json.ccmainwindow.hmainwindow.ui)file(GLOB_RECURSE MY_FILES "D:/webrtc/webrtc-checkout/src/third_party/abseil-cpp/install/lib/*.lib")message(${MY_FILES})
target_link_libraries(untitledPRIVATEWS2_32 secur32.lib winmm.lib dmoguids.lib wmcodecdspuuid.lib msdmo.lib Strmiids.lib Iphlpapi.lib ${MY_FILES} )
target_link_libraries(untitled PRIVATE Qt5::Widgets Qt5::Network jsoncpp.lib D:/webrtc/webrtc-checkout/src/out/release/obj/webrtc.lib)

其中h264在cmake中要加上-DWEBRTC_USE_H264,编译时的参数为

gn gen out/release --ide=vs --args="is_debug=true use_custom_libcxx=false rtc_enable_protobuf=false target_cpu=\"x64\" enable_iterator_debugging=true symbol_level=2 is_clang=true rtc_include_tests=true rtc_use_h264=true ffmpeg_branding=\"Chrome\" proprietary_codecs=true"

需要打开webrtc选项。这个demo的下载链接为

https://download.csdn.net/download/qq_42805085/90245215


http://www.ppmy.cn/ops/150075.html

相关文章

leetcode - 916. Word Subsets

Description You are given two string arrays words1 and words2. A string b is a subset of string a if every letter in b occurs in a including multiplicity. For example, “wrr” is a subset of “warrior” but is not a subset of “world”. A string a from …

如何将 sqlserver 数据迁移到 mysql

文章目录 前言一、导出SQL Server 数据二、转换数据格式为MySQL兼容格式三、导入数据到MySQL数据库五、使用ETL工具六、通过 navicat 工具七、总结 前言 将 SQL Server 数据迁移到 MySQL 是一个常见的数据库迁移任务,通常涉及以下几个关键步骤:导出 SQL…

Pycharm 使用教程

一、基本配置 1. 切换Python解释器 pycharm切换解释器版本 2. pycharm虚拟环境配置 虚拟环境的目的:创建适用于该项目的环境,与系统环境隔离,防止污染系统环境(包括需要的库)虚拟环境配置存放在项目根目录下的 ven…

鸿蒙面试 2025-01-11

ArkTs 和TS的关系? ArkTS(方舟开发语言)与 TypeScript(TS)存在紧密联系,同时也有显著区别: 联系 语法基础:ArkTS 在语法层面大量借鉴了 TypeScript ,TypeScript 里诸如…

蓝桥杯历届真题 #食堂(C++,Java)

这题没什么好说的 考虑所有情况然后写就完了 虽然赛场上 交完不知道答案(doge) 原题链接 #include<iostream>using namespace std;int main() {int n;cin >> n;//能优先安排6人桌,要先安排6人桌//6人桌可以是222 或者 33 或者42//优先用33组合,因为3人寝只能凑6人…

Bash语言的语法糖

Bash语言的语法糖 引言 在现代编程语言中&#xff0c;“语法糖”是一个非常常见的术语&#xff0c;它指的是那些使代码更加易读、易写的语法特性。尽管这些特性并不改变语言的功能&#xff0c;但它们能显著提升开发者的编程体验。在众多编程语言中&#xff0c;Bash&#xff0…

Linux -- 自定义协议体会序列化和反序列化

思路介绍 网络版计算器&#xff1a; 1、客户端发送 两个操作数 和 操作符&#xff1b; 2、根据协议&#xff0c;在发送时&#xff0c;对数据进行序列化&#xff0c;再加上报头&#xff0c;形成 请求 并发送给 服务器&#xff1b; 3、服务器收到 请求 后&#xff0c;判断收到的 …

HTML实战课堂之简单的拜年程序

一、目录&#xff1a; &#xfffc;&#xfffc; 一、目录&#xff1a; 二、祝福 三&#xff1a;代码讲解 &#xff08;1&#xff09;详细解释&#xff1a; 1.HTML部分 2. CSS部分 三、运行效果&#xff08;随机截图&#xff09;&#xff1a; 四、完整代码&#xff1a; 二、祝福…