Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,29 @@ Use the WebRTC branch M92 to compile.

## Usage

- Download webrtc source into webrtc_src_m74, Please refer to https://webrtc.github.io/webrtc-org/native-code/development/.
- Download webrtc source into webrtc_src_m92, Please refer to https://webrtc.github.io/webrtc-org/native-code/development/.

```
cd webrtc_src_m74/src
cd webrtc_src_m92/src
git clone https://github.com/cloudwebrtc/libwebrtc.git
```

- Modify webrtc's src/BUILD.gn file and add libwebrtc to group("default").

```patch
diff --git a/BUILD.gn b/BUILD.gn
index bfe6d02ab9..2c0eaaa631 100644
index e60d7dd0bd..b9b6acab8b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -30,6 +30,7 @@ if (!build_with_chromium) {
@@ -29,7 +29,7 @@ if (!build_with_chromium) {
# 'ninja default' and then 'ninja all', the second build should do no work.
group("default") {
testonly = true
deps = [
":webrtc",
+ "//libwebrtc:libwebrtc",
]
- deps = [ ":webrtc" ]
+ deps = [ ":webrtc","//libwebrtc:libwebrtc", ]
if (rtc_build_examples) {
deps += [ "examples" ]
}
```

- Compile
Expand Down
22 changes: 0 additions & 22 deletions include/base/portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,6 @@ namespace portable {
#ifndef _TRUNCATE
#define _TRUNCATE ((size_t)-1)
#endif // _TRUNCATE
static int strncpy_safe(char* dest,
size_t numberOfElements,
const char* src,
size_t count) {
if (!count)
return 0;
if (!dest || !src || !numberOfElements)
return -1;
size_t end = count != _TRUNCATE && count < numberOfElements
? count
: numberOfElements - 1;
size_t i = 0;
for (; i < end && src[i]; ++i) {
dest[i] = src[i];
}
if (!src[i] || end == count || count == _TRUNCATE) {
dest[i] = '\0';
return 0;
}
dest[0] = '\0';
return -1;
}
#endif

#define PORTABLE_STRING_BUF_SIZE 48
Expand Down
24 changes: 24 additions & 0 deletions src/base/portable.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
#include "include/base/portable.h"

namespace portable {

static int strncpy_safe(char* dest,
size_t numberOfElements,
const char* src,
size_t count) {
if (!count)
return 0;
if (!dest || !src || !numberOfElements)
return -1;
size_t end = count != _TRUNCATE && count < numberOfElements
? count
: numberOfElements - 1;
size_t i = 0;
for (; i < end && src[i]; ++i) {
dest[i] = src[i];
}
if (!src[i] || end == count || count == _TRUNCATE) {
dest[i] = '\0';
return 0;
}
dest[0] = '\0';
return -1;
}

string::string() : m_dynamic(0), m_length(0) {
m_buf[0] = 0;
}
Expand Down
2 changes: 2 additions & 0 deletions src/rtc_desktop_device_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ DesktopDeviceImpl::DesktopDeviceImpl() {}
webrtc::DesktopCaptureOptions DesktopDeviceImpl::CreateOptions() {
webrtc::DesktopCaptureOptions options =
webrtc::DesktopCaptureOptions::CreateDefault();
#ifdef _MSC_VER
options.set_allow_directx_capturer(false);
#endif
return options;
}

Expand Down
9 changes: 6 additions & 3 deletions src/rtc_peerconnection_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,17 @@ bool RTCPeerConnectionImpl::Initialize() {
// options.network_ignore_mask |= ADAPTER_TYPE_CELLULAR;
rtc_peerconnection_factory_->SetOptions(options);

rtc_peerconnection_ = rtc_peerconnection_factory_->CreatePeerConnection(
config, nullptr, nullptr, this);
webrtc::PeerConnectionDependencies dependencies(this);
auto result =
rtc_peerconnection_factory_->CreatePeerConnectionOrError(config, std::move(dependencies));

if (rtc_peerconnection_.get() == nullptr) {
if (!result.ok()) {
RTC_LOG(WARNING) << "CreatePeerConnection failed";
Close();
return false;
}

rtc_peerconnection_ = result.MoveValue();
return true;
}

Expand Down