Skip to content

Commit 4234540

Browse files
authored
Merge pull request #3 from Faless/channels_pr
Update to new DataChannel API, singleton load.
2 parents f2cf2e5 + 599ed98 commit 4234540

22 files changed

+943
-442
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ bin/*
44
*.lib
55
.sconsign.dblite
66
*.obj
7+
*.swp

SConstruct

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ def add_sources(sources, dirpath, extension):
99
sources.append(dirpath + '/' + f)
1010

1111

12+
def get_arch_dir(name):
13+
if name == '32':
14+
return 'x86'
15+
elif name == '64':
16+
return 'x64'
17+
return name
18+
1219
env = Environment()
1320
customs = ['custom.py']
1421
opts = Variables(customs, ARGUMENTS)
@@ -107,7 +114,7 @@ else:
107114
# Godot CPP bindings
108115
env.Append(CPPPATH=[godot_headers])
109116
env.Append(CPPPATH=[godot_cpp_headers, godot_cpp_headers + '/core', godot_cpp_headers + '/gen'])
110-
env.Append(LIBPATH=[godot_cpp_lib_dir + '/' + target])
117+
env.Append(LIBPATH=[godot_cpp_lib_dir + '/' + target + '/' + get_arch_dir(target_arch)])
111118
env.Append(LIBS=['godot-cpp'])
112119

113120
# WebRTC stuff
@@ -156,6 +163,10 @@ sources = []
156163
add_sources(sources, 'src/', 'cpp')
157164
add_sources(sources, 'src/net/', 'cpp')
158165

166+
# Suffix
167+
suffix = '.%s.%s' % (target, target_arch)
168+
env["SHOBJSUFFIX"] = suffix + env["SHOBJSUFFIX"]
169+
159170
# Make the shared library
160171
library = env.SharedLibrary(target=os.path.join(result_path, result_name), source=sources)
161172
Default(library)
File renamed without changes.
File renamed without changes.

lib/godot-cpp/release/x64/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

lib/godot-cpp/release/x86/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#include "WebRTCLibPeer.hpp"
1+
#include "WebRTCLibPeerConnection.hpp"
22

33
using namespace godot_webrtc;
44

5-
WebRTCLibPeer::GodotCSDO::GodotCSDO(WebRTCLibPeer *parent) {
5+
WebRTCLibPeerConnection::GodotCSDO::GodotCSDO(WebRTCLibPeerConnection *parent) {
66
this->parent = parent;
77
}
88

9-
void WebRTCLibPeer::GodotCSDO::OnSuccess(webrtc::SessionDescriptionInterface *desc) {
9+
void WebRTCLibPeerConnection::GodotCSDO::OnSuccess(webrtc::SessionDescriptionInterface *desc) {
1010
// serialize this offer and send it to the remote peer:
1111
std::string sdp; // sdp = session description protocol
1212
desc->ToString(&sdp);
13-
parent->queue_signal("offer_created", 2, desc->type().c_str(), sdp.c_str());
13+
parent->queue_signal("session_description_created", 2, desc->type().c_str(), sdp.c_str());
1414
};
1515

16-
void WebRTCLibPeer::GodotCSDO::OnFailure(const std::string &error){};
16+
void WebRTCLibPeerConnection::GodotCSDO::OnFailure(const std::string &error){};

src/GodotDataChannelObserver.cpp

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/GodotPeerConnectionObserver.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1-
#include "WebRTCLibPeer.hpp"
1+
#include "WebRTCLibPeerConnection.hpp"
2+
#include "WebRTCLibDataChannel.hpp"
23

34
using namespace godot_webrtc;
45

5-
WebRTCLibPeer::GodotPCO::GodotPCO(WebRTCLibPeer *parent) {
6+
WebRTCLibPeerConnection::GodotPCO::GodotPCO(WebRTCLibPeerConnection *parent) {
67
this->parent = parent;
78
}
89

9-
void WebRTCLibPeer::GodotPCO::OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) {
10+
void WebRTCLibPeerConnection::GodotPCO::OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) {
1011
}
1112

12-
void WebRTCLibPeer::GodotPCO::OnAddStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
13+
void WebRTCLibPeerConnection::GodotPCO::OnAddStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
1314
}
1415

15-
void WebRTCLibPeer::GodotPCO::OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
16+
void WebRTCLibPeerConnection::GodotPCO::OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
1617
}
1718

18-
void WebRTCLibPeer::GodotPCO::OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) {
19+
void WebRTCLibPeerConnection::GodotPCO::OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) {
20+
parent->queue_signal("data_channel_received", 1, WebRTCLibDataChannel::new_data_channel(data_channel));
1921
}
2022

21-
void WebRTCLibPeer::GodotPCO::OnRenegotiationNeeded() {
23+
void WebRTCLibPeerConnection::GodotPCO::OnRenegotiationNeeded() {
2224
}
2325

24-
void WebRTCLibPeer::GodotPCO::OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) {
26+
void WebRTCLibPeerConnection::GodotPCO::OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) {
2527
}
2628

27-
void WebRTCLibPeer::GodotPCO::OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) {
29+
void WebRTCLibPeerConnection::GodotPCO::OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) {
2830
}
2931

30-
void WebRTCLibPeer::GodotPCO::OnIceCandidate(const webrtc::IceCandidateInterface *candidate) {
32+
void WebRTCLibPeerConnection::GodotPCO::OnIceCandidate(const webrtc::IceCandidateInterface *candidate) {
3133
// Serialize the candidate and send it to the remote peer:
3234

3335
godot::Dictionary candidateSDP;
@@ -38,7 +40,7 @@ void WebRTCLibPeer::GodotPCO::OnIceCandidate(const webrtc::IceCandidateInterface
3840
candidate->ToString(&sdp);
3941
godot::String candidateSdpName = sdp.c_str();
4042

41-
parent->queue_signal("new_ice_candidate",
43+
parent->queue_signal("ice_candidate_created",
4244
3,
4345
candidateSdpMidName,
4446
candidateSdpMlineIndexName,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#include "WebRTCLibPeer.hpp"
1+
#include "WebRTCLibPeerConnection.hpp"
22

33
using namespace godot_webrtc;
44

5-
WebRTCLibPeer::GodotSSDO::GodotSSDO(WebRTCLibPeer *parent) {
5+
WebRTCLibPeerConnection::GodotSSDO::GodotSSDO(WebRTCLibPeerConnection *parent) {
66
this->parent = parent;
77
}
88

9-
void WebRTCLibPeer::GodotSSDO::OnSuccess(){};
9+
void WebRTCLibPeerConnection::GodotSSDO::OnSuccess(){};
1010

11-
void WebRTCLibPeer::GodotSSDO::OnFailure(const std::string &error){};
11+
void WebRTCLibPeerConnection::GodotSSDO::OnFailure(const std::string &error){};

0 commit comments

Comments
 (0)