mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-23 15:48:03 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
c50b055779 | |||
64e23341ad | |||
686b468d7b |
12
README.md
12
README.md
@ -8,7 +8,7 @@ Licensed under LGPLv2, see [LICENSE](https://github.com/paullouisageneau/libdata
|
||||
|
||||
## Compatibility
|
||||
|
||||
This implementation has been tested to be compatible with Firefox and Chromium. It supports Multicast DNS candidates resolution provided the operating system also supports it.
|
||||
This implementation has been tested to be compatible with Firefox and Chromium. It supports IPv6 and Multicast DNS candidates resolution provided the operating system also supports it.
|
||||
|
||||
## Dependencies
|
||||
|
||||
@ -21,13 +21,13 @@ Submodules:
|
||||
## Building
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
make
|
||||
$ git submodule update --init --recursive
|
||||
$ make
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
In the following example, notes the callbacks are called in another thread.
|
||||
In the following example, note the callbacks are called in another thread.
|
||||
|
||||
### Signal a PeerConnection
|
||||
|
||||
@ -37,7 +37,7 @@ In the following example, notes the callbacks are called in another thread.
|
||||
|
||||
```cpp
|
||||
rtc::Configuration config;
|
||||
config.iceServers.emplace_back("stunserver.org:3478");
|
||||
config.iceServers.emplace_back("mystunserver.org:3478");
|
||||
|
||||
auto pc = make_shared<rtc::PeerConnection>(config);
|
||||
|
||||
@ -81,7 +81,7 @@ dc->onMessage([](const variant<binary, string> &message) {
|
||||
|
||||
```cpp
|
||||
shared_ptr<rtc::DataChannel> dc;
|
||||
pc->onDataChannel([&dc](const shared_ptr<rtc::DataChannel> &incoming) {
|
||||
pc->onDataChannel([&dc](shared_ptr<rtc::DataChannel> incoming) {
|
||||
dc = incoming;
|
||||
dc->send("Hello world!");
|
||||
});
|
||||
|
@ -81,7 +81,7 @@ Candidate::Candidate(string candidate, string mid) {
|
||||
ss << foundation << sp << component << sp << transport << sp << priority;
|
||||
ss << sp << nodebuffer << sp << servbuffer << sp << "typ" << sp << type;
|
||||
if (!left.empty())
|
||||
ss << sp << left;
|
||||
ss << left;
|
||||
mCandidate = ss.str();
|
||||
break;
|
||||
}
|
||||
|
@ -63,8 +63,6 @@ void PeerConnection::addRemoteCandidate(Candidate candidate) {
|
||||
|
||||
if (mIceTransport->addRemoteCandidate(candidate))
|
||||
mRemoteDescription->addCandidate(std::make_optional(std::move(candidate)));
|
||||
else
|
||||
std::cerr << "Failed to add remote ICE candidate" << std::endl;
|
||||
}
|
||||
|
||||
shared_ptr<DataChannel> PeerConnection::createDataChannel(const string &label,
|
||||
|
@ -27,8 +27,11 @@ using namespace rtc;
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
auto pc1 = std::make_shared<PeerConnection>();
|
||||
auto pc2 = std::make_shared<PeerConnection>();
|
||||
rtc::Configuration config;
|
||||
config.iceServers.emplace_back("stun.l.google.com:19302");
|
||||
|
||||
auto pc1 = std::make_shared<PeerConnection>(config);
|
||||
auto pc2 = std::make_shared<PeerConnection>(config);
|
||||
|
||||
pc1->onLocalDescription([pc2](const Description &sdp) {
|
||||
cout << "Description 1: " << sdp << endl;
|
||||
|
Reference in New Issue
Block a user