Changeset 110735 in webkit


Ignore:
Timestamp:
Mar 14, 2012 12:53:23 PM (12 years ago)
Author:
tommyw@google.com
Message:

MediaStream API (JSEP): Introducing IceCandidate
https://bugs.webkit.org/show_bug.cgi?id=80699

Reviewed by Adam Barth.

Patch #2 in a series of patches to change the PeerConnection from ROAP to JSEP,
see bug 80589 for more information.
Adding the JS object IceCandidate and its WebCore/platform sibling IceCandidateDescriptor.
This object will be created both from JS and the embedder.

Not possible to test until the entire JSEP feature is commited.

  • GNUmakefile.list.am:
  • Modules/mediastream/IceCandidate.cpp: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.

(WebCore):
(WebCore::IceCandidate::create):
(WebCore::IceCandidate::IceCandidate):
(WebCore::IceCandidate::~IceCandidate):
(WebCore::IceCandidate::label):
(WebCore::IceCandidate::candidateLine):
(WebCore::IceCandidate::toSdp):
(WebCore::IceCandidate::descriptor):

  • Modules/mediastream/IceCandidate.h: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.

(WebCore):
(IceCandidate):

  • Modules/mediastream/IceCandidate.idl: Added.
  • WebCore.gypi:
  • platform/mediastream/IceCandidateDescriptor.cpp: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.

(WebCore):
(WebCore::IceCandidateDescriptor::create):
(WebCore::IceCandidateDescriptor::IceCandidateDescriptor):
(WebCore::IceCandidateDescriptor::~IceCandidateDescriptor):
(WebCore::IceCandidateDescriptor::toSdp):

  • platform/mediastream/IceCandidateDescriptor.h: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.

(WebCore):
(IceCandidateDescriptor):
(WebCore::IceCandidateDescriptor::label):
(WebCore::IceCandidateDescriptor::candidateLine):

  • platform/mediastream/MediaStreamCenter.cpp:

(WebCore::MediaStreamCenter::constructSdp):
(WebCore):

  • platform/mediastream/MediaStreamCenter.h:

(WebCore):
(MediaStreamCenter):

Location:
trunk/Source/WebCore
Files:
1 added
5 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r110732 r110735  
     12012-03-14  Tommy Widenflycht  <tommyw@google.com>
     2
     3        MediaStream API (JSEP): Introducing IceCandidate
     4        https://bugs.webkit.org/show_bug.cgi?id=80699
     5
     6        Reviewed by Adam Barth.
     7
     8        Patch #2 in a series of patches to change the PeerConnection from ROAP to JSEP,
     9        see bug 80589 for more information.
     10        Adding the JS object IceCandidate and its WebCore/platform sibling IceCandidateDescriptor.
     11        This object will be created both from JS and the embedder.
     12
     13        Not possible to test until the entire JSEP feature is commited.
     14
     15        * GNUmakefile.list.am:
     16        * Modules/mediastream/IceCandidate.cpp: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.
     17        (WebCore):
     18        (WebCore::IceCandidate::create):
     19        (WebCore::IceCandidate::IceCandidate):
     20        (WebCore::IceCandidate::~IceCandidate):
     21        (WebCore::IceCandidate::label):
     22        (WebCore::IceCandidate::candidateLine):
     23        (WebCore::IceCandidate::toSdp):
     24        (WebCore::IceCandidate::descriptor):
     25        * Modules/mediastream/IceCandidate.h: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.
     26        (WebCore):
     27        (IceCandidate):
     28        * Modules/mediastream/IceCandidate.idl: Added.
     29        * WebCore.gypi:
     30        * platform/mediastream/IceCandidateDescriptor.cpp: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.
     31        (WebCore):
     32        (WebCore::IceCandidateDescriptor::create):
     33        (WebCore::IceCandidateDescriptor::IceCandidateDescriptor):
     34        (WebCore::IceCandidateDescriptor::~IceCandidateDescriptor):
     35        (WebCore::IceCandidateDescriptor::toSdp):
     36        * platform/mediastream/IceCandidateDescriptor.h: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.
     37        (WebCore):
     38        (IceCandidateDescriptor):
     39        (WebCore::IceCandidateDescriptor::label):
     40        (WebCore::IceCandidateDescriptor::candidateLine):
     41        * platform/mediastream/MediaStreamCenter.cpp:
     42        (WebCore::MediaStreamCenter::constructSdp):
     43        (WebCore):
     44        * platform/mediastream/MediaStreamCenter.h:
     45        (WebCore):
     46        (MediaStreamCenter):
     47
    1482012-03-14  Simon Fraser  <simon.fraser@apple.com>
    249
  • trunk/Source/WebCore/GNUmakefile.list.am

    r110669 r110735  
    345345        DerivedSources/WebCore/JSHTMLVideoElement.cpp \
    346346        DerivedSources/WebCore/JSHTMLVideoElement.h \
     347        DerivedSources/WebCore/JSIceCandidate.cpp \
     348        DerivedSources/WebCore/JSIceCandidate.h \
    347349        DerivedSources/WebCore/JSImageData.cpp \
    348350        DerivedSources/WebCore/JSImageData.h \
     
    661663        $(WebCore)/Modules/mediastream/DeprecatedPeerConnection.idl \
    662664        $(WebCore)/Modules/mediastream/DOMWindowMediaStream.idl \
     665        $(WebCore)/Modules/mediastream/IceCandidate.idl \
    663666        $(WebCore)/Modules/mediastream/LocalMediaStream.idl \
    664667        $(WebCore)/Modules/mediastream/MediaStream.idl \
     
    10341037        Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.cpp \
    10351038        Source/WebCore/Modules/mediastream/DeprecatedPeerConnection.h \
     1039        Source/WebCore/Modules/mediastream/IceCandidate.cpp \
     1040        Source/WebCore/Modules/mediastream/IceCandidate.h \
    10361041        Source/WebCore/Modules/mediastream/LocalMediaStream.cpp \
    10371042        Source/WebCore/Modules/mediastream/LocalMediaStream.h \
     
    33233328        Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandler.h \
    33243329        Source/WebCore/platform/mediastream/DeprecatedPeerConnectionHandlerClient.h \
     3330        Source/WebCore/platform/mediastream/IceCandidateDescriptor.cpp \
     3331        Source/WebCore/platform/mediastream/IceCandidateDescriptor.h \
    33253332        Source/WebCore/platform/mediastream/MediaStreamCenter.cpp \
    33263333        Source/WebCore/platform/mediastream/MediaStreamCenter.h \
  • trunk/Source/WebCore/Modules/mediastream/IceCandidate.cpp

    r110733 r110735  
    11/*
    2  * Copyright (C) 2011 Ericsson AB. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1212 *    in the documentation and/or other materials provided with the
    1313 *    distribution.
    14  * 3. Neither the name of Ericsson nor the names of its contributors
     14 * 3. Neither the name of Google Inc. nor the names of its contributors
    1515 *    may be used to endorse or promote products derived from this
    1616 *    software without specific prior written permission.
     
    3333#if ENABLE(MEDIA_STREAM)
    3434
    35 #include "MediaStreamCenter.h"
     35#include "IceCandidate.h"
    3636
    37 #include "MainThread.h"
    38 #include "MediaStreamDescriptor.h"
     37#include "IceCandidateDescriptor.h"
    3938
    4039namespace WebCore {
    4140
    42 MediaStreamCenter& MediaStreamCenter::instance()
     41PassRefPtr<IceCandidate> IceCandidate::create(const String& label, const String& candidateLine)
    4342{
    44     ASSERT(isMainThread());
    45     DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ());
    46     return center;
     43    return adoptRef(new IceCandidate(IceCandidateDescriptor::create(label, candidateLine)));
    4744}
    4845
    49 void MediaStreamCenter::endLocalMediaStream(MediaStreamDescriptor* streamDescriptor)
     46PassRefPtr<IceCandidate> IceCandidate::create(PassRefPtr<IceCandidateDescriptor> descriptor)
    5047{
    51     MediaStreamDescriptorOwner* owner = streamDescriptor->owner();
    52     if (owner)
    53         owner->streamEnded();
    54     else
    55         streamDescriptor->setEnded();
     48    return adoptRef(new IceCandidate(descriptor));
    5649}
    5750
    58 #if !PLATFORM(CHROMIUM)
    59 
    60 // Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter.
    61 
    62 MediaStreamCenter::MediaStreamCenter()
     51IceCandidate::IceCandidate(PassRefPtr<IceCandidateDescriptor> descriptor)
     52    : m_descriptor(descriptor)
    6353{
    6454}
    6555
    66 MediaStreamCenter::~MediaStreamCenter()
     56IceCandidate::~IceCandidate()
    6757{
    6858}
    6959
    70 void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
     60const String& IceCandidate::label()
    7161{
    72     MediaStreamSourceVector audioSources, videoSources;
    73     client->didCompleteQuery(audioSources, videoSources);
     62    return m_descriptor->label();
    7463}
    7564
    76 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
     65const String& IceCandidate::candidateLine()
    7766{
     67    return m_descriptor->candidateLine();
    7868}
    7969
    80 void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor*)
     70String IceCandidate::toSdp()
    8171{
     72    return m_descriptor->toSdp();
    8273}
    8374
    84 void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor*)
     75IceCandidateDescriptor* IceCandidate::descriptor()
    8576{
     77    return m_descriptor.get();
    8678}
    87 
    88 #endif // !PLATFORM(CHROMIUM)
    8979
    9080} // namespace WebCore
  • trunk/Source/WebCore/Modules/mediastream/IceCandidate.h

    r110733 r110735  
    11/*
    2  * Copyright (C) 2011 Ericsson AB. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1212 *    in the documentation and/or other materials provided with the
    1313 *    distribution.
    14  * 3. Neither the name of Ericsson nor the names of its contributors
     14 * 3. Neither the name of Google Inc. nor the names of its contributors
    1515 *    may be used to endorse or promote products derived from this
    1616 *    software without specific prior written permission.
     
    2929 */
    3030
    31 #include "config.h"
     31#ifndef IceCandidate_h
     32#define IceCandidate_h
    3233
    3334#if ENABLE(MEDIA_STREAM)
    3435
    35 #include "MediaStreamCenter.h"
    36 
    37 #include "MainThread.h"
    38 #include "MediaStreamDescriptor.h"
     36#include <wtf/PassRefPtr.h>
     37#include <wtf/RefCounted.h>
     38#include <wtf/RefPtr.h>
     39#include <wtf/text/WTFString.h>
    3940
    4041namespace WebCore {
    4142
    42 MediaStreamCenter& MediaStreamCenter::instance()
    43 {
    44     ASSERT(isMainThread());
    45     DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ());
    46     return center;
    47 }
     43class IceCandidateDescriptor;
    4844
    49 void MediaStreamCenter::endLocalMediaStream(MediaStreamDescriptor* streamDescriptor)
    50 {
    51     MediaStreamDescriptorOwner* owner = streamDescriptor->owner();
    52     if (owner)
    53         owner->streamEnded();
    54     else
    55         streamDescriptor->setEnded();
    56 }
     45class IceCandidate : public RefCounted<IceCandidate> {
     46public:
     47    static PassRefPtr<IceCandidate> create(const String& label, const String& candidateLine);
     48    static PassRefPtr<IceCandidate> create(PassRefPtr<IceCandidateDescriptor>);
     49    virtual ~IceCandidate();
    5750
    58 #if !PLATFORM(CHROMIUM)
     51    const String& label();
     52    const String& candidateLine();
    5953
    60 // Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter.
     54    String toSdp();
    6155
    62 MediaStreamCenter::MediaStreamCenter()
    63 {
    64 }
     56    IceCandidateDescriptor* descriptor();
    6557
    66 MediaStreamCenter::~MediaStreamCenter()
    67 {
    68 }
     58private:
     59    IceCandidate(PassRefPtr<IceCandidateDescriptor>);
    6960
    70 void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
    71 {
    72     MediaStreamSourceVector audioSources, videoSources;
    73     client->didCompleteQuery(audioSources, videoSources);
    74 }
    75 
    76 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
    77 {
    78 }
    79 
    80 void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor*)
    81 {
    82 }
    83 
    84 void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor*)
    85 {
    86 }
    87 
    88 #endif // !PLATFORM(CHROMIUM)
     61    RefPtr<IceCandidateDescriptor> m_descriptor;
     62};
    8963
    9064} // namespace WebCore
    9165
    9266#endif // ENABLE(MEDIA_STREAM)
     67
     68#endif // IceCandidate_h
  • trunk/Source/WebCore/WebCore.gypi

    r110641 r110735  
    420420            'platform/mediastream/DeprecatedPeerConnectionHandler.h',
    421421            'platform/mediastream/DeprecatedPeerConnectionHandlerClient.h',
     422            'platform/mediastream/IceCandidateDescriptor.cpp',
     423            'platform/mediastream/IceCandidateDescriptor.h',
    422424            'platform/mediastream/MediaStreamCenter.cpp',
    423425            'platform/mediastream/MediaStreamCenter.h',
     
    754756            'Modules/mediastream/DeprecatedPeerConnection.idl',
    755757            'Modules/mediastream/DOMWindowMediaStream.idl',
     758            'Modules/mediastream/IceCandidate.idl',
    756759            'Modules/mediastream/LocalMediaStream.idl',
    757760            'Modules/mediastream/MediaStream.idl',
     
    13871390            'Modules/mediastream/DeprecatedPeerConnection.cpp',
    13881391            'Modules/mediastream/DeprecatedPeerConnection.h',
     1392            'Modules/mediastream/IceCandidate.cpp',
     1393            'Modules/mediastream/IceCandidate.h',
    13891394            'Modules/mediastream/LocalMediaStream.cpp',
    13901395            'Modules/mediastream/LocalMediaStream.h',
  • trunk/Source/WebCore/platform/mediastream/IceCandidateDescriptor.cpp

    r110733 r110735  
    11/*
    2  * Copyright (C) 2011 Ericsson AB. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1212 *    in the documentation and/or other materials provided with the
    1313 *    distribution.
    14  * 3. Neither the name of Ericsson nor the names of its contributors
     14 * 3. Neither the name of Google Inc. nor the names of its contributors
    1515 *    may be used to endorse or promote products derived from this
    1616 *    software without specific prior written permission.
     
    3333#if ENABLE(MEDIA_STREAM)
    3434
     35#include "IceCandidateDescriptor.h"
     36
    3537#include "MediaStreamCenter.h"
    36 
    37 #include "MainThread.h"
    38 #include "MediaStreamDescriptor.h"
    3938
    4039namespace WebCore {
    4140
    42 MediaStreamCenter& MediaStreamCenter::instance()
     41PassRefPtr<IceCandidateDescriptor> IceCandidateDescriptor::create(const String& label, const String& candidateLine)
    4342{
    44     ASSERT(isMainThread());
    45     DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ());
    46     return center;
     43    return adoptRef(new IceCandidateDescriptor(label, candidateLine));
    4744}
    4845
    49 void MediaStreamCenter::endLocalMediaStream(MediaStreamDescriptor* streamDescriptor)
    50 {
    51     MediaStreamDescriptorOwner* owner = streamDescriptor->owner();
    52     if (owner)
    53         owner->streamEnded();
    54     else
    55         streamDescriptor->setEnded();
    56 }
    57 
    58 #if !PLATFORM(CHROMIUM)
    59 
    60 // Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter.
    61 
    62 MediaStreamCenter::MediaStreamCenter()
     46IceCandidateDescriptor::IceCandidateDescriptor(const String& label, const String& candidateLine)
     47    : m_label(label)
     48    , m_candidateLine(candidateLine)
    6349{
    6450}
    6551
    66 MediaStreamCenter::~MediaStreamCenter()
     52IceCandidateDescriptor::~IceCandidateDescriptor()
    6753{
    6854}
    6955
    70 void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
     56String IceCandidateDescriptor::toSdp()
    7157{
    72     MediaStreamSourceVector audioSources, videoSources;
    73     client->didCompleteQuery(audioSources, videoSources);
     58    return MediaStreamCenter::instance().constructSdp(this);
    7459}
    75 
    76 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
    77 {
    78 }
    79 
    80 void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor*)
    81 {
    82 }
    83 
    84 void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor*)
    85 {
    86 }
    87 
    88 #endif // !PLATFORM(CHROMIUM)
    8960
    9061} // namespace WebCore
  • trunk/Source/WebCore/platform/mediastream/IceCandidateDescriptor.h

    r110733 r110735  
    11/*
    2  * Copyright (C) 2011 Ericsson AB. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1212 *    in the documentation and/or other materials provided with the
    1313 *    distribution.
    14  * 3. Neither the name of Ericsson nor the names of its contributors
     14 * 3. Neither the name of Google Inc. nor the names of its contributors
    1515 *    may be used to endorse or promote products derived from this
    1616 *    software without specific prior written permission.
     
    2929 */
    3030
    31 #include "config.h"
     31#ifndef IceCandidateDescriptor_h
     32#define IceCandidateDescriptor_h
    3233
    3334#if ENABLE(MEDIA_STREAM)
    3435
    35 #include "MediaStreamCenter.h"
    36 
    37 #include "MainThread.h"
    38 #include "MediaStreamDescriptor.h"
     36#include <wtf/PassRefPtr.h>
     37#include <wtf/RefCounted.h>
     38#include <wtf/text/WTFString.h>
    3939
    4040namespace WebCore {
    4141
    42 MediaStreamCenter& MediaStreamCenter::instance()
    43 {
    44     ASSERT(isMainThread());
    45     DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ());
    46     return center;
    47 }
     42class IceCandidateDescriptor : public RefCounted<IceCandidateDescriptor> {
     43public:
     44    static PassRefPtr<IceCandidateDescriptor> create(const String& label, const String& candidateLine);
     45    virtual ~IceCandidateDescriptor();
    4846
    49 void MediaStreamCenter::endLocalMediaStream(MediaStreamDescriptor* streamDescriptor)
    50 {
    51     MediaStreamDescriptorOwner* owner = streamDescriptor->owner();
    52     if (owner)
    53         owner->streamEnded();
    54     else
    55         streamDescriptor->setEnded();
    56 }
     47    const String& label() { return m_label; }
     48    const String& candidateLine() { return m_candidateLine; }
    5749
    58 #if !PLATFORM(CHROMIUM)
     50    String toSdp();
    5951
    60 // Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter.
     52private:
     53    IceCandidateDescriptor(const String& label, const String& candidateLine);
    6154
    62 MediaStreamCenter::MediaStreamCenter()
    63 {
    64 }
    65 
    66 MediaStreamCenter::~MediaStreamCenter()
    67 {
    68 }
    69 
    70 void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
    71 {
    72     MediaStreamSourceVector audioSources, videoSources;
    73     client->didCompleteQuery(audioSources, videoSources);
    74 }
    75 
    76 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
    77 {
    78 }
    79 
    80 void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor*)
    81 {
    82 }
    83 
    84 void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor*)
    85 {
    86 }
    87 
    88 #endif // !PLATFORM(CHROMIUM)
     55    String m_label;
     56    String m_candidateLine;
     57};
    8958
    9059} // namespace WebCore
    9160
    9261#endif // ENABLE(MEDIA_STREAM)
     62
     63#endif // IceCandidateDescriptor_h
  • trunk/Source/WebCore/platform/mediastream/MediaStreamCenter.cpp

    r106581 r110735  
    5656}
    5757
     58String MediaStreamCenter::constructSdp(IceCandidateDescriptor*)
     59{
     60    return "";
     61}
     62
    5863#if !PLATFORM(CHROMIUM)
    5964
  • trunk/Source/WebCore/platform/mediastream/MediaStreamCenter.h

    r106581 r110735  
    4343#endif
    4444
     45class IceCandidateDescriptor;
    4546class MediaStreamComponent;
    4647class MediaStreamDescriptor;
     
    7576    void didConstructMediaStream(MediaStreamDescriptor*);
    7677
     78    String constructSdp(IceCandidateDescriptor*);
     79
    7780    // Calls from the platform to update the DOM objects
    7881    void endLocalMediaStream(MediaStreamDescriptor*);
Note: See TracChangeset for help on using the changeset viewer.