Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
aff7f49
fixes
ispysoftware Mar 30, 2020
6cd2dc7
add ice candidate
ispysoftware Apr 1, 2020
7928b15
fix
ispysoftware Apr 1, 2020
2172dfa
updates
ispysoftware Apr 1, 2020
8a09967
Add resolve method to ice candidate
ispysoftware Apr 1, 2020
3e3ea15
fixes
ispysoftware Apr 1, 2020
7db767e
try again
ispysoftware Apr 1, 2020
91079d5
try2
ispysoftware Apr 1, 2020
d63efc3
try 3
ispysoftware Apr 1, 2020
ae621a0
m
ispysoftware Apr 1, 2020
226b6dc
xcv
ispysoftware Apr 1, 2020
f9f2217
a
ispysoftware Apr 1, 2020
1c644ab
a
ispysoftware Apr 1, 2020
00e174a
a
ispysoftware Apr 1, 2020
809ec51
h
ispysoftware Apr 1, 2020
95aff5b
datachannel stuff
ispysoftware Apr 2, 2020
5a6e66e
a
ispysoftware Apr 2, 2020
096ffcd
cap W
ispysoftware Apr 2, 2020
d25f927
add status
ispysoftware Apr 2, 2020
29bd31c
a
ispysoftware Apr 2, 2020
1457a89
a
ispysoftware Apr 2, 2020
52342cc
a
ispysoftware Apr 2, 2020
14ea6d2
b
ispysoftware Apr 2, 2020
898f36c
send data
ispysoftware Apr 2, 2020
3091c06
send updates
ispysoftware Apr 2, 2020
79cce04
a
ispysoftware Apr 2, 2020
bd345de
c
ispysoftware Apr 2, 2020
b9dfc75
d
ispysoftware Apr 2, 2020
8fc55d0
d
ispysoftware Apr 2, 2020
1001d33
g
ispysoftware Apr 2, 2020
5eafce2
h
ispysoftware Apr 2, 2020
2141efb
j
ispysoftware Apr 2, 2020
72bab18
k
ispysoftware Apr 2, 2020
5cb04b3
l
ispysoftware Apr 2, 2020
7cf67e4
m
ispysoftware Apr 2, 2020
f926444
add callback code
ispysoftware Apr 3, 2020
a4b68f4
fix
ispysoftware Apr 3, 2020
d3e504f
fix 2
ispysoftware Apr 3, 2020
8da0703
fix3
ispysoftware Apr 3, 2020
2cc718f
fixes
ispysoftware Apr 3, 2020
3ad8f82
return state enum
ispysoftware Apr 3, 2020
164d806
update status for enum
ispysoftware Apr 3, 2020
b1d89c9
test
ispysoftware Apr 3, 2020
dad791b
try fix audio
ispysoftware Apr 4, 2020
4904566
sdf
ispysoftware Apr 4, 2020
612e061
code cleanup
ispysoftware Apr 4, 2020
6294d57
release datachannel
ispysoftware Apr 5, 2020
4121d65
add cs call
ispysoftware Apr 5, 2020
081025d
move header call
ispysoftware Apr 5, 2020
4da9eaf
fixes
ispysoftware Apr 5, 2020
783973b
fixes
ispysoftware Apr 5, 2020
46ed2ee
remove delete
ispysoftware Apr 5, 2020
c5ba7f0
fix callback name
ispysoftware Apr 5, 2020
2ebc766
fix naming
ispysoftware Apr 5, 2020
2b63289
Add linux build
ispysoftware Apr 5, 2020
7333aad
target x86
ispysoftware Apr 5, 2020
17f38b4
remove linux x86
ispysoftware Apr 5, 2020
6868ec8
x86 win build update
ispysoftware Apr 5, 2020
bcc6712
remove x86 license generation
ispysoftware Apr 5, 2020
a740903
add license
ispysoftware Apr 5, 2020
a7a234a
add dummy audio devices
ispysoftware Apr 7, 2020
b4ae6d7
add to other builds
ispysoftware Apr 7, 2020
190bd47
fix marshalling
ispysoftware May 1, 2020
c4d5608
updates
ispysoftware Jul 8, 2020
b534d6f
update error handler
ispysoftware Jul 8, 2020
c7a449a
add build platforms
ispysoftware Jul 8, 2020
4dba880
remove x86
ispysoftware Jul 8, 2020
4c60739
remove winx64
ispysoftware Jul 8, 2020
baef370
remove ;
ispysoftware Jul 10, 2020
ac923d2
add winx64
ispysoftware Jul 10, 2020
17b9bd4
Revert "update error handler"
ispysoftware Jul 10, 2020
4255836
add turn server
ispysoftware Jul 10, 2020
6be9603
fark
ispysoftware Jul 10, 2020
b6e46dd
add turn server
ispysoftware Jul 14, 2020
cb34f26
remove debug info
ispysoftware Jul 16, 2020
9c3dbcb
updates to managed code
ispysoftware Sep 3, 2020
7f9cb99
fixes for msbuild
ispysoftware Sep 3, 2020
437a40d
various updates
ispysoftware Sep 6, 2020
bfff25e
updates
ispysoftware Sep 6, 2020
e663995
add flags for h264 compilation
ispysoftware Sep 7, 2020
76ed06e
updates
ispysoftware Feb 22, 2021
15179cd
remove webrtc proj build
ispysoftware Feb 22, 2021
ba03c79
remove tabs
ispysoftware Feb 22, 2021
fd161e7
update sources
ispysoftware Feb 24, 2023
65e1c57
bug fixes, playback timing update
ispysoftware Jul 10, 2023
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
1 change: 1 addition & 0 deletions .gclient
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'solutions=[{name:src,url:https://www.github.com/ispysoftware/webrtc@origin/nudi}]'
2 changes: 1 addition & 1 deletion api/jsep.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ enum class SdpType {

// Description must be treated as an SDP final answer, and the offer-
// answer exchange must be considered complete after receiving this.
kAnswer = WEBRTC_SDP_TYPE_ANSER
kAnswer = WEBRTC_SDP_TYPE_ANSWER
};

// Returns the string form of the given SDP type. String forms are defined in
Expand Down
28 changes: 15 additions & 13 deletions media/base/video_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,22 +220,24 @@ bool VideoAdapter::AdaptFrameResolution(int in_width,
const Fraction scale = FindScale((*cropped_width) * (*cropped_height),
target_pixel_count, max_pixel_count);

// Make sure the resulting dimensions are aligned correctly to be nice to
// hardware encoders.
*out_width =
roundUp(*cropped_width * scale.numerator,
scale.denominator * required_resolution_alignment_,
in_width * scale.numerator) / scale.denominator;
*out_height =
roundUp(*cropped_height * scale.numerator,
scale.denominator * required_resolution_alignment_,
in_height * scale.numerator) / scale.denominator;
// Adjust cropping slightly to get even integer output size and a perfect
// scale factor. Make sure the resulting dimensions are aligned correctly
// to be nice to hardware encoders.
*cropped_width =
roundUp(*cropped_width,
scale.denominator * required_resolution_alignment_, in_width);
*cropped_height =
roundUp(*cropped_height,
scale.denominator * required_resolution_alignment_, in_height);
RTC_DCHECK_EQ(0, *cropped_width % scale.denominator);
RTC_DCHECK_EQ(0, *cropped_height % scale.denominator);

// Calculate final output size.
*out_width = *cropped_width / scale.denominator * scale.numerator;
*out_height = *cropped_height / scale.denominator * scale.numerator;
RTC_DCHECK_EQ(0, *out_width % required_resolution_alignment_);
RTC_DCHECK_EQ(0, *out_height % required_resolution_alignment_);

*cropped_width = (*out_width * scale.denominator + scale.numerator - 1) / scale.numerator;
*cropped_height = (*out_height * scale.denominator + scale.numerator - 1) / scale.numerator;

++frames_out_;
if (scale.numerator != scale.denominator)
++frames_scaled_;
Expand Down
6 changes: 3 additions & 3 deletions modules/desktop_capture/win/dxgi_output_duplicator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ bool DxgiOutputDuplicator::DoDetectUpdatedRegion(
return false;
}

if (metadata_.capacity() < frame_info.TotalMetadataBufferSize) {
if (metadata_.size() < frame_info.TotalMetadataBufferSize) {
metadata_.clear(); // Avoid data copy
metadata_.reserve(frame_info.TotalMetadataBufferSize);
}
Expand All @@ -283,7 +283,7 @@ bool DxgiOutputDuplicator::DoDetectUpdatedRegion(
reinterpret_cast<DXGI_OUTDUPL_MOVE_RECT*>(metadata_.data());
size_t move_rects_count = 0;
_com_error error = duplication_->GetFrameMoveRects(
static_cast<UINT>(metadata_.capacity()), move_rects, &buff_size);
static_cast<UINT>(metadata_.size()), move_rects, &buff_size);
if (error.Error() != S_OK) {
RTC_LOG(LS_ERROR) << "Failed to get move rectangles, error "
<< error.ErrorMessage() << ", code " << error.Error();
Expand All @@ -294,7 +294,7 @@ bool DxgiOutputDuplicator::DoDetectUpdatedRegion(
RECT* dirty_rects = reinterpret_cast<RECT*>(metadata_.data() + buff_size);
size_t dirty_rects_count = 0;
error = duplication_->GetFrameDirtyRects(
static_cast<UINT>(metadata_.capacity()) - buff_size, dirty_rects,
static_cast<UINT>(metadata_.size()) - buff_size, dirty_rects,
&buff_size);
if (error.Error() != S_OK) {
RTC_LOG(LS_ERROR) << "Failed to get dirty rectangles, error "
Expand Down
1 change: 0 additions & 1 deletion p2p/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ if (rtc_include_tests) {
}

rtc_source_set("p2p_server_utils") {
testonly = true
sources = [
"base/relay_server.cc",
"base/relay_server.h",
Expand Down
2 changes: 1 addition & 1 deletion p2p/base/turn_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ TurnServerAllocation* TurnServer::CreateAllocation(TurnServerConnection* conn,
RTC_DCHECK(thread_checker_.IsCurrent());
rtc::AsyncPacketSocket* external_socket =
(external_socket_factory_)
? external_socket_factory_->CreateUdpSocket(external_addr_, 0, 0)
? external_socket_factory_->CreateUdpSocket(external_addr_, min_udp_port_, max_udp_port_)
: NULL;
if (!external_socket) {
return NULL;
Expand Down
6 changes: 6 additions & 0 deletions p2p/base/turn_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ class TurnServer : public sigslot::has_slots<> {
RTC_DCHECK(thread_checker_.IsCurrent());
realm_ = realm;
}
void set_port_range(size_t min_udp_port, size_t max_udp_port){
min_udp_port_ = min_udp_port;
max_udp_port_ = max_udp_port;
}

// Gets/sets the value for the SOFTWARE attribute for TURN messages.
const std::string& software() const {
Expand Down Expand Up @@ -336,6 +340,8 @@ class TurnServer : public sigslot::has_slots<> {
std::vector<std::unique_ptr<rtc::AsyncPacketSocket>> sockets_to_delete_;
std::unique_ptr<rtc::PacketSocketFactory> external_socket_factory_;
rtc::SocketAddress external_addr_;
size_t min_udp_port_ = 0;
size_t max_udp_port_ = 0;

AllocationMap allocations_;

Expand Down
1 change: 0 additions & 1 deletion rtc_base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,6 @@ rtc_source_set("testclient") {
}

rtc_source_set("rtc_base_tests_utils") {
testonly = true
sources = [
"cpu_time.cc",
"cpu_time.h",
Expand Down
3 changes: 1 addition & 2 deletions rtc_base/virtual_socket_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1026,10 +1026,9 @@ void VirtualSocketServer::UpdateDelayDistribution() {
}
}

static double PI = 4 * atan(1.0);

static double Normal(double x, double mean, double stddev) {
double a = (x - mean) * (x - mean) / (2 * stddev * stddev);
double PI = 4 * atan(1.0);
return exp(-a) / (stddev * sqrt(2 * PI));
}

Expand Down
6 changes: 4 additions & 2 deletions sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,7 @@ if (is_ios || is_mac) {
"..:no_global_constructors",
]
sources = [
"objc/api/peerconnection/RTCAudioDeviceModule+Private.h",
"objc/api/peerconnection/RTCAudioDeviceModule.h",
"objc/api/peerconnection/RTCAudioDeviceModule.mm",
"objc/api/peerconnection/RTCAudioSource+Private.h",
"objc/api/peerconnection/RTCAudioSource.h",
"objc/api/peerconnection/RTCAudioSource.mm",
Expand Down Expand Up @@ -954,6 +952,10 @@ if (is_ios || is_mac) {
]

if (is_ios) {
sources += [
"objc/api/peerconnection/RTCAudioDeviceModule+Private.h",
"objc/api/peerconnection/RTCAudioDeviceModule.mm",
]
deps += [ ":native_api_audio_device_module" ]
}
}
Expand Down
1 change: 1 addition & 0 deletions sdk/c/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rtc_source_set("c") {
deps = [
"api:audio_codecs",
"api:create_peerconnection_factory",
"api:create_turn_server",
"api:libjingle_peerconnection_api",
"api:video_codecs",
"api/video:video_frame",
Expand Down
14 changes: 14 additions & 0 deletions sdk/c/api/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ rtc_source_set("video_codecs") {
"../../../api/video_codecs:builtin_video_encoder_factory",
]
}

rtc_source_set("create_turn_server") {
sources = [
"create_turn_server.cc",
"create_turn_server.h",
]
deps = [
"../../../p2p:p2p_server_utils",
"../../../p2p:rtc_p2p",
"../../../pc:rtc_pc",
"../../../rtc_base",
"../../../rtc_base:rtc_base_approved",
]
}
95 changes: 95 additions & 0 deletions sdk/c/api/create_turn_server.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright 2012 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <iostream>
#include <map>
#include <string>
#include <utility>

#include "p2p/base/basic_packet_socket_factory.h"
#include "p2p/base/port_interface.h"
#include "p2p/base/turn_server.h"
#include "rtc_base/async_udp_socket.h"
#include "rtc_base/ip_address.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/socket_server.h"
#include "rtc_base/thread.h"
#include "rtc_base/string_encode.h"
#include "create_turn_server.h"


namespace {
class TurnFileAuth : public cricket::TurnAuthInterface {
public:
explicit TurnFileAuth(std::map<std::string, std::string> name_to_key)
: name_to_key_(std::move(name_to_key)) {}

virtual bool GetKey(const std::string& username,
const std::string& realm,
std::string* key) {
auto it = name_to_key_.find(username);
std::cerr << "TURN: Welcome " << username << std::endl;
if (it == name_to_key_.end()) {
return false;
}
*key = it->second;
return true;
}

private:
const std::map<std::string, std::string> name_to_key_;
};

} // namespace

RTC_EXPORT extern "C" void webrtcCreateTURNServer(
RtcThread* network_thread,
const char* local_addr,
const char* ip_addr,
size_t min_port,
size_t max_port) {

rtc::Thread* thread = rtc::ToCplusplus(network_thread);
rtc::SocketAddress int_addr;
if (!int_addr.FromString(local_addr)) {
std::cerr << "Unable to parse socket address: " << local_addr << std::endl;
return;
}

rtc::IPAddress ext_addr;
if (!IPFromString(ip_addr, &ext_addr)) {
std::cerr << "Unable to parse IP address: " << ip_addr << std::endl;
return;
}

rtc::AsyncUDPSocket* int_socket =
rtc::AsyncUDPSocket::Create(thread->socketserver(), int_addr);
if (!int_socket) {
std::cerr << "Failed to create a UDP socket bound at " << int_addr.ToString()
<< std::endl;
return;
}

cricket::TurnServer server(thread);
std::string pwd = "a8a16ccd399c0a716e1bca6be0016d6f";
char buf[32];
size_t len = rtc::hex_decode(buf, sizeof(buf), pwd.data(),pwd.size());
std::map<std::string, std::string> usrs = {
{"user",std::string(buf, len)}
};
TurnFileAuth auth(usrs);
server.set_realm("Agent");
server.set_software("Agent");
server.set_port_range(min_port,max_port);
server.set_auth_hook(&auth);
server.AddInternalSocket(int_socket, cricket::PROTO_UDP);
server.SetExternalSocketFactory(new rtc::BasicPacketSocketFactory(),
rtc::SocketAddress(ext_addr, 0));
thread->Run();
}
25 changes: 25 additions & 0 deletions sdk/c/api/create_turn_server.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2019 pixiv Inc. All Rights Reserved.
*
* Use of this source code is governed by a license that can be
* found in the LICENSE.pixiv file in the root of the source tree.
*/

#include "sdk/c/interop.h"
#include "sdk/c/rtc_base/thread.h"

#ifdef __cplusplus
extern "C" {
#endif

RTC_EXPORT void webrtcCreateTURNServer(
RtcThread* network_thread,
const char* local_addr,
const char* ip_addr,
size_t min_port,
size_t max_port);

#ifdef __cplusplus
}
#endif

Loading