Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 55c9142

Browse files
authored
Enable OWT build with MSDK on Windows. (#664)
1 parent ec936d1 commit 55c9142

15 files changed

+141
-166
lines changed

talk/owt/BUILD.gn

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ if (is_android) {
5858
}
5959
}
6060

61-
config("owt_symbols") {
61+
config("owt_common") {
6262
defines = [ "OWT_LIBRARY_IMPL" ]
6363
if (is_component_build) {
6464
defines += [ "OWT_ENABLE_SYMBOL_EXPORT" ]
6565
}
66+
if (owt_msdk_header_root != "") {
67+
defines += [ "OWT_USE_MSDK" ]
68+
}
6669
}
6770

6871
static_library("owt_deps") {
@@ -212,7 +215,7 @@ static_library("owt_sdk_base") {
212215
"//third_party",
213216
]
214217

215-
configs += [ ":owt_symbols" ]
218+
configs += [ ":owt_common" ]
216219

217220
defines = [ "USE_BUILTIN_SW_CODECS" ]
218221

@@ -287,6 +290,8 @@ static_library("owt_sdk_base") {
287290
"sdk/base/win/d3d11_allocator.h",
288291
"sdk/base/win/d3d_allocator.cc",
289292
"sdk/base/win/d3d_allocator.h",
293+
"sdk/base/win/mediacapabilities.cc",
294+
"sdk/base/win/mediacapabilities.h",
290295
"sdk/base/win/msdkvideobase.cc",
291296
"sdk/base/win/msdkvideobase.h",
292297
"sdk/base/win/msdkvideodecoder.cc",
@@ -297,11 +302,16 @@ static_library("owt_sdk_base") {
297302
"sdk/base/win/msdkvideoencoder.h",
298303
"sdk/base/win/msdkvideoencoderfactory.cc",
299304
"sdk/base/win/msdkvideoencoderfactory.h",
305+
"sdk/base/win/sysmem_allocator.cc",
300306
"sdk/base/win/sysmem_allocator.h",
307+
"sdk/base/win/vp9ratecontrol.cc",
301308
"sdk/base/win/vp9ratecontrol.h",
302309
"sdk/base/win/vpedefs.h",
303310
]
304-
public_deps += [ "//third_party/libvpx" ]
311+
public_deps += [
312+
"//third_party/libvpx",
313+
"//third_party/libvpx:libvpxrc",
314+
]
305315
include_dirs += [
306316
"//third_party/libvpx/source/config",
307317
"//third_party/libvpx/source/config/$current_os/$cpu_arch_full",
@@ -313,7 +323,6 @@ static_library("owt_sdk_base") {
313323
if (is_linux) {
314324
if (owt_msdk_header_root != "") {
315325
include_dirs += [ owt_msdk_header_root ]
316-
defines += [ "OWT_USE_MSDK" ]
317326
sources += [
318327
"sdk/base/linux/displayutils.cc",
319328
"sdk/base/linux/displayutils.h",
@@ -324,7 +333,6 @@ static_library("owt_sdk_base") {
324333
"sdk/base/linux/xwindownativeframe.h",
325334
"sdk/base/windowcapturer.cc",
326335
]
327-
defines += [ "OWT_USE_MSDK" ]
328336
}
329337
sources += [
330338
"sdk/base/linux/videorenderlinux.cc",
@@ -380,7 +388,7 @@ static_library("owt_sdk_p2p") {
380388
if (is_clang) {
381389
configs -= [ "//build/config/clang:find_bad_constructs" ]
382390
}
383-
configs += [ ":owt_symbols" ]
391+
configs += [ ":owt_common" ]
384392
if (owt_cloud_gaming) {
385393
defines = [ "OWT_CLOUD_GAMING" ]
386394
}
@@ -423,6 +431,7 @@ static_library("owt_sdk_conf") {
423431
include_dirs += [ owt_quic_header_root ]
424432
}
425433
}
434+
configs += [ ":owt_common" ]
426435
}
427436
if (is_ios) {
428437
static_library("owt_sdk_objc") {

talk/owt/docs/cpp/cpp.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ bug fixes and known issues.
99
# 2 Supported platforms {#section2}
1010
Open WebRTC Toolkit Client SDK for Windows supports Windows 8 and later versions.
1111
# 3 Getting started {#section3}
12-
Application on Open WebRTC Toolkit Client SDK for Windows should be built with Microsoft Visual Studio\* 2017 or 2019. Running time library for linking should be `Multi-threaded Debug (/MTd)` for debug version or `Multi-threaded (/MT)` for release version. Supported platform is x64.
12+
Application on Open WebRTC Toolkit Client SDK for Windows should be built with Microsoft Visual Studio\* 2022. Running time library for linking should be `Multi-threaded Debug (/MTd)` for debug version or `Multi-threaded (/MT)` for release version. Supported platform is x64.
1313
The release package includes one sample application to get you started quickly with the SDK. The following two static libraries are provided in the SDK for only x64, along with their headers:
1414
- owt-debug.lib - this library includes all the WebRTC features for debug usages.
1515
- owt-release.lib - this library includes all the WebRTC features for release usages.
1616
owt-debug.lib|owt-release references libraries in Windows SDK for DXVA support. Your application must statically link
1717
mfuuid.lib, mf.lib, mfplat.lib, d3d9.lib, dxgi.lib, d3d11.lib, dcomp.lib and dxva2.lib to build. Depending on your signaling
18-
channel implementation, you can optionally link sioclient.lib or sioclient_tls.lib if neccessary.
18+
channel implementation, you can optionally link sioclient.lib or sioclient_tls.lib if necessary. When building your app with
19+
OWT, please define WEBRTC_WIN for Windows build. If the OWT lib was built with Intel Media SDK (msdk_root is specified for
20+
build-win.py, or owt_msdk_header_root is defined in GN args), your app needs to define OWT_USE_MSDK as well.
1921
# 4 Socket.IO {#section4}
2022
Socket.IO cpp client is an open source project hosted on [Github](https://github.com/socketio/socket.io-client-cpp). Please follow official guide on GitHub to build and link it. The version works with OWT is b1216ee428dd7d1e72368da9b12aa43bfc487c93.
2123
The Socket.IO TLS feature is determined at compile time and cannot be switched at runtime. If you are using secure connections, link your application statically with sioclient_tls.lib; otherwise, link it with sioclient.lib. Please be noted the SDK library is linking to OpenSSL 1.1.1, so sioclient_tls.lib must be compiled using the same OpenSSL version.

talk/owt/sdk/base/customizedvideodecoderproxy.cc

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
namespace owt {
88
namespace base {
99

10+
std::unordered_map<webrtc::VideoCodecType, owt::base::VideoCodec>
11+
video_codec_map = {
12+
{webrtc::VideoCodecType::kVideoCodecH264, owt::base::VideoCodec::kH264},
13+
#ifdef WEBRTC_USE_H265
14+
{webrtc::VideoCodecType::kVideoCodecH265, owt::base::VideoCodec::kH265},
15+
#endif
16+
{webrtc::VideoCodecType::kVideoCodecVP8, owt::base::VideoCodec::kVp8},
17+
{webrtc::VideoCodecType::kVideoCodecVP9, owt::base::VideoCodec::kVp9},
18+
{webrtc::VideoCodecType::kVideoCodecAV1, owt::base::VideoCodec::kAv1},
19+
};
20+
1021
CustomizedVideoDecoderProxy::CustomizedVideoDecoderProxy(VideoCodecType type,
1122
VideoDecoderInterface* external_video_decoder)
1223
: codec_type_(type),decoded_image_callback_(nullptr), external_decoder_(external_video_decoder) {}
@@ -22,25 +33,9 @@ bool CustomizedVideoDecoderProxy::Configure(const Settings& codec_settings) {
2233
RTC_CHECK(codec_settings.codec_type() == codec_type_)
2334
<< "Unsupported codec type" << codec_settings.codec_type() << " for "
2435
<< codec_type_;
25-
if (external_decoder_) {
26-
if (codec_type_ == kVideoCodecH264 &&
27-
external_decoder_->InitDecodeContext(VideoCodec::kH264)) {
28-
return true;
29-
#ifdef WEBRTC_USE_H265
30-
} else if (codec_type_ == kVideoCodecH265 &&
31-
external_decoder_->InitDecodeContext(VideoCodec::kH265)) {
32-
return true;
33-
#endif
34-
} else if (codec_type_ == kVideoCodecVP8 &&
35-
external_decoder_->InitDecodeContext(VideoCodec::kVp8)) {
36-
return true;
37-
} else if (codec_type_ == kVideoCodecVP9 &&
38-
external_decoder_->InitDecodeContext(VideoCodec::kVp9)) {
39-
return true;
40-
} else if (codec_type_ == kVideoCodecAV1 &&
41-
external_decoder_->InitDecodeContext(VideoCodec::kAv1)) {
42-
return true;
43-
}
36+
RTC_DCHECK(video_codec_map.contains(codec_type_));
37+
if (!external_decoder_ ||
38+
!external_decoder_->InitDecodeContext(video_codec_map[codec_type_])) {
4439
return false;
4540
}
4641
return true;

talk/owt/sdk/base/peerconnectiondependencyfactory.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void PeerConnectionDependencyFactory::
205205
GlobalConfiguration::GetCustomizedVideoDecoder()));
206206
} else if (render_hardware_acceleration_enabled_) {
207207
#ifdef OWT_USE_MSDK
208-
decoder_factory.reset(new MSDKVideoDecoderFactory());
208+
decoder_factory.reset(new MSDKVideoDecoderFactory(nullptr));
209209
#else
210210
decoder_factory = webrtc::CreateBuiltinVideoDecoderFactory();
211211
#endif

talk/owt/sdk/base/win/base_allocator.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,14 @@ mfxStatus BaseFrameAllocator::AllocFrames(mfxFrameAllocRequest *request, mfxFram
183183
return sts;
184184
}
185185

186-
mfxStatus BaseFrameAllocator::FreeFrames(mfxFrameAllocResponse *response)
187-
{
186+
bool IsSame(const mfxFrameAllocResponse& lhs,
187+
const mfxFrameAllocResponse& rhs) {
188+
return rhs.mids != 0 && lhs.mids != 0 && rhs.mids[0] == lhs.mids[0] &&
189+
rhs.NumFrameActual == lhs.NumFrameActual;
190+
}
191+
192+
mfxStatus
193+
BaseFrameAllocator::FreeFrames(mfxFrameAllocResponse * response) {
188194
std::lock_guard<std::mutex> lock(mtx);
189195

190196
if (response == 0)
@@ -194,7 +200,8 @@ mfxStatus BaseFrameAllocator::FreeFrames(mfxFrameAllocResponse *response)
194200

195201
// check whether response is an external decoder response
196202
std::list<UniqueResponse>::iterator i =
197-
std::find_if( m_ExtResponses.begin(), m_ExtResponses.end(), std::bind1st(IsSame(), *response));
203+
std::find_if(m_ExtResponses.begin(), m_ExtResponses.end(),
204+
std::bind(IsSame, *response, std::placeholders::_1));
198205

199206
if (i != m_ExtResponses.end())
200207
{
@@ -208,7 +215,8 @@ mfxStatus BaseFrameAllocator::FreeFrames(mfxFrameAllocResponse *response)
208215

209216
// if not found so far, then search in internal responses
210217
std::list<mfxFrameAllocResponse>::iterator i2 =
211-
std::find_if(m_responses.begin(), m_responses.end(), std::bind1st(IsSame(), *response));
218+
std::find_if(m_responses.begin(), m_responses.end(),
219+
std::bind(IsSame, *response, std::placeholders::_1));
212220

213221
if (i2 != m_responses.end())
214222
{

talk/owt/sdk/base/win/base_allocator.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,6 @@ class BaseFrameAllocator : public MFXFrameAllocator {
182182
std::list<mfxFrameAllocResponse> m_responses;
183183
std::list<UniqueResponse> m_ExtResponses;
184184

185-
struct IsSame : public std::binary_function<mfxFrameAllocResponse,
186-
mfxFrameAllocResponse,
187-
bool> {
188-
bool operator()(const mfxFrameAllocResponse& l,
189-
const mfxFrameAllocResponse& r) const {
190-
return r.mids != 0 && l.mids != 0 && r.mids[0] == l.mids[0] &&
191-
r.NumFrameActual == l.NumFrameActual;
192-
}
193-
};
194-
195185
// checks if request is supported
196186
virtual mfxStatus CheckRequestType(mfxFrameAllocRequest* request);
197187

0 commit comments

Comments
 (0)