Compare commits

..

3 Commits

Author SHA1 Message Date
c50b055779 Updated Readme 2019-09-10 23:45:47 +02:00
64e23341ad Added STUN server to test 2019-09-10 23:45:31 +02:00
686b468d7b Fixed double space in generated srflx candidates 2019-09-10 23:44:54 +02:00
4 changed files with 12 additions and 11 deletions

View File

@ -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!");
});

View File

@ -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;
}

View File

@ -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,

View File

@ -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;