Skip to content

M92 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 26, 2021
Merged

M92 #14

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
24 changes: 1 addition & 23 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 Expand Up @@ -104,7 +82,7 @@ class string {
}

inline std::string std_string() const {
return std::string(m_dynamic == 0 ? m_buf : m_dynamic);
return std::string(m_dynamic == 0 ? m_buf : m_dynamic, m_length);
}
};

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
15 changes: 9 additions & 6 deletions src/rtc_peerconnection_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ void RTCPeerConnectionImpl::OnSignalingChange(

void RTCPeerConnectionImpl::AddCandidate(const string mid,
int mid_mline_index,
const string candiate) {
const string cand_sdp) {
webrtc::SdpParseError error;
webrtc::IceCandidateInterface* candidate = webrtc::CreateIceCandidate(
to_std_string(mid), mid_mline_index, to_std_string(candiate), &error);
if (!candidate)
to_std_string(mid), mid_mline_index, to_std_string(cand_sdp), &error);
if (candidate != nullptr)
rtc_peerconnection_->AddIceCandidate(candidate);
}

Expand Down 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
9 changes: 3 additions & 6 deletions src/rtc_rtp_parameters_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,15 @@ webrtc::RtpParameters RTCRtpParametersImpl::rtp_parameters() {
}

const string RTCRtpParametersImpl::transaction_id() {
auto temp = rtp_parameters_.transaction_id;
return temp;
return rtp_parameters_.transaction_id;
}

void RTCRtpParametersImpl::set_transaction_id(const string id) {
rtp_parameters_.transaction_id = to_std_string(id);
}

const string RTCRtpParametersImpl::mid() {
auto temp = rtp_parameters_.mid;
return temp;
return rtp_parameters_.mid;
}
void RTCRtpParametersImpl::set_mid(const string mid) {
rtp_parameters_.mid = to_std_string(mid);
Expand Down Expand Up @@ -308,8 +306,7 @@ webrtc::RtpExtension RTCRtpExtensionImpl::rtp_extension() {
}

const string RTCRtpExtensionImpl::ToString() const {
auto temp = rtp_extension_.ToString();
return temp;
return rtp_extension_.ToString();
}

RTCRtpCodecParametersImpl::RTCRtpCodecParametersImpl(
Expand Down