Changeset 165247 in webkit


Ignore:
Timestamp:
Mar 6, 2014 9:41:16 PM (10 years ago)
Author:
thiago.lacerda@openbossa.org
Message:

[WebRTC] Updating RTCIceServer to match spec
https://bugs.webkit.org/show_bug.cgi?id=129844

Reviewed by Eric Carlson.

Move RTCIceServer from RTCConfiguration to its own file.

  • Modules/mediastream/RTCPeerConnection.cpp:

(WebCore::validateIceServerURL):
(WebCore::processIceServer):

  • platform/mediastream/RTCConfiguration.h:

(WebCore::RTCConfiguration::iceServers):

  • platform/mediastream/RTCIceServer.h: Added.
Location:
trunk/Source/WebCore
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r165246 r165247  
     12014-03-06  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
     2
     3        [WebRTC] Updating RTCIceServer to match spec
     4        https://bugs.webkit.org/show_bug.cgi?id=129844
     5
     6        Reviewed by Eric Carlson.
     7
     8        Move RTCIceServer from RTCConfiguration to its own file.
     9
     10        * Modules/mediastream/RTCPeerConnection.cpp:
     11        (WebCore::validateIceServerURL):
     12        (WebCore::processIceServer):
     13        * platform/mediastream/RTCConfiguration.h:
     14        (WebCore::RTCConfiguration::iceServers):
     15        * platform/mediastream/RTCIceServer.h: Added.
     16
    1172014-03-06  Hyowon Kim  <hw1008.kim@samsung.com>
    218
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp

    r165226 r165247  
    6767namespace WebCore {
    6868
    69 static bool appendIceServer(const String& iceURL, const String& credential, const String& username, RTCConfiguration* rtcConfiguration)
     69static bool validateIceServerURL(const String& iceURL)
    7070{
    7171    URL url(URL(), iceURL);
     
    7373        return false;
    7474
    75     rtcConfiguration->appendServer(RTCIceServer::create(url, credential, username));
    7675    return true;
    7776}
     
    9392    // then checking for a comma in the string assures that a string was a sequence and then we convert
    9493    // it to a sequence safely.
     94    if (urlString.isEmpty())
     95        return INVALID_ACCESS_ERR;
     96
    9597    if (urlString.find(',') != notFound && iceServer.get("urls", urlsList) && urlsList.size()) {
    9698        for (auto iter = urlsList.begin(); iter != urlsList.end(); ++iter) {
    97             if (!appendIceServer((*iter), credential, username, rtcConfiguration))
     99            if (!validateIceServerURL(*iter))
    98100                return INVALID_ACCESS_ERR;
    99101        }
    100 
    101         return 0;
    102     }
    103 
    104     if (!urlString.isEmpty() && appendIceServer(urlString, credential, username, rtcConfiguration))
    105         return 0;
    106 
    107     return INVALID_ACCESS_ERR;
     102    } else {
     103        if (!validateIceServerURL(urlString))
     104            return INVALID_ACCESS_ERR;
     105
     106        urlsList.append(urlString);
     107    }
     108
     109    rtcConfiguration->appendServer(RTCIceServer::create(urlsList, credential, username));
     110    return 0;
    108111}
    109112
  • trunk/Source/WebCore/platform/mediastream/RTCConfiguration.h

    r164372 r165247  
    3434#if ENABLE(MEDIA_STREAM)
    3535
    36 #include "URL.h"
     36#include "RTCIceServer.h"
    3737#include <wtf/PassRefPtr.h>
    3838#include <wtf/RefCounted.h>
     
    4141
    4242namespace WebCore {
    43 
    44 class RTCIceServer : public RefCounted<RTCIceServer> {
    45 public:
    46     static PassRefPtr<RTCIceServer> create(const URL& uri, const String& credential, const String& username)
    47     {
    48         return adoptRef(new RTCIceServer(uri, credential, username));
    49     }
    50     virtual ~RTCIceServer() { }
    51 
    52     const URL& uri() { return m_uri; }
    53     const String& credential() { return m_credential; }
    54     const String& username() { return m_username; }
    55 
    56 private:
    57     RTCIceServer(const URL& uri, const String& credential, const String& username)
    58         : m_uri(uri)
    59         , m_credential(credential)
    60         , m_username(username)
    61     {
    62     }
    63 
    64     URL m_uri;
    65     String m_credential;
    66     String m_username;
    67 };
    6843
    6944class RTCConfiguration : public RefCounted<RTCConfiguration> {
     
    7550    size_t numberOfServers() { return m_servers.size(); }
    7651    RTCIceServer* server(size_t index) { return m_servers[index].get(); }
     52
    7753    const String& iceTransports() const { return m_iceTransports; }
    7854    void setIceTransports(const String& iceTransports)
     
    8157            m_iceTransports = iceTransports;
    8258    }
     59
    8360    const String& requestIdentity() const { return m_requestIdentity; }
    8461    void setRequestIdentity(const String& requestIdentity)
     
    8764            m_requestIdentity = requestIdentity;
    8865    }
     66
     67    Vector<RefPtr<RTCIceServer>> iceServers() const { return m_servers; }
    8968
    9069 private:
Note: See TracChangeset for help on using the changeset viewer.