Exemplo n.º 1
0
void toWebRTCIceServers(PassRefPtr<RTCConfiguration> configuration, webrtc::PeerConnectionInterface::IceServers* servers)
{
    if (!configuration.get() || !servers)
        return;

    for (size_t i = 0; i < configuration->numberOfServers(); ++i) {
        webrtc::PeerConnectionInterface::IceServer webRTCServer;
        RTCIceServer* iceServer = configuration->server(i);
        webRTCServer.username = iceServer->username().utf8().data();
        webRTCServer.password = iceServer->credential().utf8().data();
        webRTCServer.uri = iceServer->uri().string().utf8().data();
        servers->push_back(webRTCServer);
    }
}
static void getNativeIceServers(const PassRefPtr<RTCConfiguration> configuration, webrtc::PeerConnectionInterface::IceServers* servers) 
{
    if (!configuration.get() || !servers)
      return;
    
    for (size_t i = 0; i < configuration->numberOfServers(); ++i) {
      webrtc::PeerConnectionInterface::IceServer server;
      RTCIceServer* webkitServer = configuration->server(i);
      server.password.assign(webkitServer->credential().utf8().data(), webkitServer->credential().length());
      server.username.assign(webkitServer->username().utf8().data(), webkitServer->username().length());
      server.uri.assign(webkitServer->uri().string().utf8().data(), webkitServer->uri().string().length());
      servers->push_back(server);
    }
}