Changeset 113462 in webkit


Ignore:
Timestamp:
Apr 6, 2012 11:23:56 AM (12 years ago)
Author:
tommyw@google.com
Message:

MediaStream API: Deleting the chromium bridge class MediaStreamCenterInternal
https://bugs.webkit.org/show_bug.cgi?id=83167

Reviewed by Adam Barth.

The situation before this patch is that we had a MediaStreamCenter.h with #ifdefs for the chromium specific
private class MediaStreamCenterInternal. This bridge class only shuffled calls between MediaStreamCenter and
WebMediaStreamCenter and was needed before the introduction of Platform.
To get rid of this now unnecessary class I had two alternatives:
1) Sprinkle platform/MediaStreamCenter.h with more #ifdefs, including around the class declaration.
2) Create an abstract base class that the chromium and gstreamer implementations overrides.
My personal preference is 2) since I strongly dislike #ifdefs. The drawback is that MediaStreamCenter now
has a vtable. However since all methods in this class are extremely low-usage it doesn't affect anything
in practice.

No code behaviour changes.

  • GNUmakefile.am:
  • GNUmakefile.list.am:
  • Modules/mediastream/MediaStreamTrack.cpp:

(WebCore::MediaStreamTrack::setEnabled):

  • Modules/mediastream/UserMediaRequest.cpp:
  • Modules/mediastream/UserMediaRequest.h:
  • WebCore.gyp/WebCore.gyp:
  • WebCore.gypi:
  • platform/chromium/support/WebMediaStreamSourcesRequest.cpp:
  • platform/mediastream/MediaStreamCenter.cpp:

(WebCore::MediaStreamCenter::MediaStreamCenter):
(WebCore):
(WebCore::MediaStreamCenter::~MediaStreamCenter):

  • platform/mediastream/MediaStreamCenter.h:

(WebCore):
(MediaStreamCenter):

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

(WebCore):
(MediaStreamSourcesQueryClient):
(WebCore::MediaStreamSourcesQueryClient::~MediaStreamSourcesQueryClient):

  • platform/mediastream/chromium/MediaStreamCenterChromium.cpp:

(WebCore::MediaStreamCenter::instance):
(WebCore::MediaStreamCenterChromium::MediaStreamCenterChromium):
(WebCore::MediaStreamCenterChromium::~MediaStreamCenterChromium):
(WebCore::MediaStreamCenterChromium::queryMediaStreamSources):
(WebCore::MediaStreamCenterChromium::didSetMediaStreamTrackEnabled):
(WebCore::MediaStreamCenterChromium::didStopLocalMediaStream):
(WebCore::MediaStreamCenterChromium::didConstructMediaStream):
(WebCore::MediaStreamCenterChromium::constructSDP):
(WebCore):
(WebCore::MediaStreamCenterChromium::stopLocalMediaStream):

  • platform/mediastream/chromium/MediaStreamCenterChromium.h: Renamed from Source/WebCore/platform/mediastream/chromium/MediaStreamCenterInternal.h.

(WebKit):
(WebCore):
(MediaStreamCenterChromium):

  • platform/mediastream/chromium/MediaStreamCenterInternal.cpp: Removed.
  • platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.

(WebCore):
(WebCore::MediaStreamCenter::instance):
(WebCore::MediaStreamCenterGStreamer::MediaStreamCenterGStreamer):
(WebCore::MediaStreamCenterGStreamer::~MediaStreamCenterGStreamer):
(WebCore::MediaStreamCenterGStreamer::queryMediaStreamSources):
(WebCore::MediaStreamCenterGStreamer::didSetMediaStreamTrackEnabled):
(WebCore::MediaStreamCenterGStreamer::didStopLocalMediaStream):
(WebCore::MediaStreamCenterGStreamer::didConstructMediaStream):
(WebCore::MediaStreamCenterGStreamer::constructSDP):

  • platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.h.

(WebCore):
(MediaStreamCenterGStreamer):

Location:
trunk/Source/WebCore
Files:
1 deleted
12 edited
3 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113461 r113462  
     12012-04-06  Tommy Widenflycht  <tommyw@google.com>
     2
     3        MediaStream API: Deleting the chromium bridge class MediaStreamCenterInternal
     4        https://bugs.webkit.org/show_bug.cgi?id=83167
     5
     6        Reviewed by Adam Barth.
     7
     8        The situation before this patch is that we had a MediaStreamCenter.h with #ifdefs for the chromium specific
     9        private class MediaStreamCenterInternal. This bridge class only shuffled calls between MediaStreamCenter and
     10        WebMediaStreamCenter and was needed before the introduction of Platform.
     11        To get rid of this now unnecessary class I had two alternatives:
     12        1) Sprinkle platform/MediaStreamCenter.h with more #ifdefs, including around the class declaration.
     13        2) Create an abstract base class that the chromium and gstreamer implementations overrides.
     14        My personal preference is 2) since I strongly dislike #ifdefs. The drawback is that MediaStreamCenter now
     15        has a vtable. However since all methods in this class are extremely low-usage it doesn't affect anything
     16        in practice.
     17
     18        No code behaviour changes.
     19
     20        * GNUmakefile.am:
     21        * GNUmakefile.list.am:
     22        * Modules/mediastream/MediaStreamTrack.cpp:
     23        (WebCore::MediaStreamTrack::setEnabled):
     24        * Modules/mediastream/UserMediaRequest.cpp:
     25        * Modules/mediastream/UserMediaRequest.h:
     26        * WebCore.gyp/WebCore.gyp:
     27        * WebCore.gypi:
     28        * platform/chromium/support/WebMediaStreamSourcesRequest.cpp:
     29        * platform/mediastream/MediaStreamCenter.cpp:
     30        (WebCore::MediaStreamCenter::MediaStreamCenter):
     31        (WebCore):
     32        (WebCore::MediaStreamCenter::~MediaStreamCenter):
     33        * platform/mediastream/MediaStreamCenter.h:
     34        (WebCore):
     35        (MediaStreamCenter):
     36        * platform/mediastream/MediaStreamSourcesQueryClient.h: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.h.
     37        (WebCore):
     38        (MediaStreamSourcesQueryClient):
     39        (WebCore::MediaStreamSourcesQueryClient::~MediaStreamSourcesQueryClient):
     40        * platform/mediastream/chromium/MediaStreamCenterChromium.cpp:
     41        (WebCore::MediaStreamCenter::instance):
     42        (WebCore::MediaStreamCenterChromium::MediaStreamCenterChromium):
     43        (WebCore::MediaStreamCenterChromium::~MediaStreamCenterChromium):
     44        (WebCore::MediaStreamCenterChromium::queryMediaStreamSources):
     45        (WebCore::MediaStreamCenterChromium::didSetMediaStreamTrackEnabled):
     46        (WebCore::MediaStreamCenterChromium::didStopLocalMediaStream):
     47        (WebCore::MediaStreamCenterChromium::didConstructMediaStream):
     48        (WebCore::MediaStreamCenterChromium::constructSDP):
     49        (WebCore):
     50        (WebCore::MediaStreamCenterChromium::stopLocalMediaStream):
     51        * platform/mediastream/chromium/MediaStreamCenterChromium.h: Renamed from Source/WebCore/platform/mediastream/chromium/MediaStreamCenterInternal.h.
     52        (WebKit):
     53        (WebCore):
     54        (MediaStreamCenterChromium):
     55        * platform/mediastream/chromium/MediaStreamCenterInternal.cpp: Removed.
     56        * platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.cpp.
     57        (WebCore):
     58        (WebCore::MediaStreamCenter::instance):
     59        (WebCore::MediaStreamCenterGStreamer::MediaStreamCenterGStreamer):
     60        (WebCore::MediaStreamCenterGStreamer::~MediaStreamCenterGStreamer):
     61        (WebCore::MediaStreamCenterGStreamer::queryMediaStreamSources):
     62        (WebCore::MediaStreamCenterGStreamer::didSetMediaStreamTrackEnabled):
     63        (WebCore::MediaStreamCenterGStreamer::didStopLocalMediaStream):
     64        (WebCore::MediaStreamCenterGStreamer::didConstructMediaStream):
     65        (WebCore::MediaStreamCenterGStreamer::constructSDP):
     66        * platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h: Copied from Source/WebCore/platform/mediastream/MediaStreamCenter.h.
     67        (WebCore):
     68        (MediaStreamCenterGStreamer):
     69
    1702012-04-05  Simon Fraser  <simon.fraser@apple.com>
    271
  • trunk/Source/WebCore/GNUmakefile.am

    r112658 r113462  
    6969        -I$(srcdir)/Source/WebCore/platform/leveldb \
    7070        -I$(srcdir)/Source/WebCore/platform/mediastream \
     71        -I$(srcdir)/Source/WebCore/platform/mediastream/gstreamer \
    7172        -I$(srcdir)/Source/WebCore/platform/mock \
    7273        -I$(srcdir)/Source/WebCore/platform/network \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r113448 r113462  
    33853385        Source/WebCore/platform/mediastream/SessionDescriptionDescriptor.h \
    33863386        Source/WebCore/platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp \
     3387        Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp \
     3388        Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h \
    33873389        Source/WebCore/platform/mock/DeviceOrientationClientMock.cpp \
    33883390        Source/WebCore/platform/mock/DeviceOrientationClientMock.h \
  • trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp

    r108383 r113462  
    8383
    8484    if (m_streamDescriptor->ended())
    85         return;   
     85        return;
    8686
    8787    MediaStreamCenter::instance().didSetMediaStreamTrackEnabled(m_streamDescriptor.get(), m_component.get());
  • trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp

    r108437 r113462  
    3636
    3737#include "LocalMediaStream.h"
     38#include "MediaStreamCenter.h"
    3839#include "SpaceSplitString.h"
    3940#include "UserMediaController.h"
  • trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h

    r108437 r113462  
    3535
    3636#include "ActiveDOMObject.h"
    37 #include "MediaStreamCenter.h"
    3837#include "MediaStreamSource.h"
     38#include "MediaStreamSourcesQueryClient.h"
    3939#include "NavigatorUserMediaErrorCallback.h"
    4040#include "NavigatorUserMediaSuccessCallback.h"
  • trunk/Source/WebCore/WebCore.gyp/WebCore.gyp

    r113422 r113462  
    125125      '../platform/leveldb',
    126126      '../platform/mediastream',
     127      '../platform/mediastream/chromium',
    127128      '../platform/mock',
    128129      '../platform/network',
  • trunk/Source/WebCore/WebCore.gypi

    r113448 r113462  
    442442            'platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.h',
    443443            'platform/mediastream/chromium/MediaStreamCenterChromium.cpp',
    444             'platform/mediastream/chromium/MediaStreamCenterInternal.cpp',
    445             'platform/mediastream/chromium/MediaStreamCenterInternal.h',
     444            'platform/mediastream/chromium/MediaStreamCenterChromium.h',
    446445            'platform/mediastream/chromium/PeerConnection00Handler.cpp',
    447446            'platform/mediastream/chromium/PeerConnection00HandlerInternal.cpp',
  • trunk/Source/WebCore/platform/chromium/support/WebMediaStreamSourcesRequest.cpp

    r113218 r113462  
    3535#include <public/WebMediaStreamSourcesRequest.h>
    3636
    37 #include "MediaStreamCenter.h"
    3837#include "MediaStreamSource.h"
     38#include "MediaStreamSourcesQueryClient.h"
    3939#include <public/WebMediaStreamSource.h>
    4040#include <public/WebVector.h>
  • trunk/Source/WebCore/platform/mediastream/MediaStreamCenter.cpp

    r111874 r113462  
    11/*
    22 * Copyright (C) 2011 Ericsson AB. All rights reserved.
     3 * Copyright (C) 2012 Google Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3536#include "MediaStreamCenter.h"
    3637
    37 #include "IceCandidateDescriptor.h"
    3838#include "MediaStreamDescriptor.h"
    39 #include "SessionDescriptionDescriptor.h"
    40 
    41 #include <wtf/MainThread.h>
    4239
    4340namespace WebCore {
    4441
    45 MediaStreamCenter& MediaStreamCenter::instance()
     42MediaStreamCenter::MediaStreamCenter()
    4643{
    47     ASSERT(isMainThread());
    48     DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ());
    49     return center;
     44}
     45
     46MediaStreamCenter::~MediaStreamCenter()
     47{
    5048}
    5149
     
    5957}
    6058
    61 #if !PLATFORM(CHROMIUM)
    62 
    63 // Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter.
    64 
    65 MediaStreamCenter::MediaStreamCenter()
    66 {
    67 }
    68 
    69 MediaStreamCenter::~MediaStreamCenter()
    70 {
    71 }
    72 
    73 void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
    74 {
    75     MediaStreamSourceVector audioSources, videoSources;
    76     client->didCompleteQuery(audioSources, videoSources);
    77 }
    78 
    79 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
    80 {
    81 }
    82 
    83 void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor*)
    84 {
    85 }
    86 
    87 void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor*)
    88 {
    89 }
    90 
    91 String MediaStreamCenter::constructSDP(IceCandidateDescriptor*)
    92 {
    93     return "";
    94 }
    95 
    96 String MediaStreamCenter::constructSDP(SessionDescriptionDescriptor*)
    97 {
    98     return "";
    99 }
    100 
    101 #endif // !PLATFORM(CHROMIUM)
    102 
    10359} // namespace WebCore
    10460
  • trunk/Source/WebCore/platform/mediastream/MediaStreamCenter.h

    r111577 r113462  
    3535#if ENABLE(MEDIA_STREAM)
    3636
    37 #include "MediaStreamSource.h"
    38 #include <wtf/OwnPtr.h>
     37#include <wtf/PassRefPtr.h>
     38#include <wtf/text/WTFString.h>
    3939
    4040namespace WebCore {
    41 
    42 #if PLATFORM(CHROMIUM)
    43 class MediaStreamCenterInternal;
    44 #endif
    4541
    4642class IceCandidateDescriptor;
    4743class MediaStreamComponent;
    4844class MediaStreamDescriptor;
     45class MediaStreamSourcesQueryClient;
    4946class SessionDescriptionDescriptor;
    5047
    51 class MediaStreamSourcesQueryClient : public RefCounted<MediaStreamSourcesQueryClient> {
     48class MediaStreamCenter {
    5249public:
    53     virtual ~MediaStreamSourcesQueryClient() { }
    54 
    55     virtual bool audio() const = 0;
    56     virtual bool video() const = 0;
    57     virtual bool cameraPreferenceUser() const = 0;
    58     virtual bool cameraPreferenceEnvironment() const = 0;
    59 
    60     virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0;
    61 };
    62 
    63 class MediaStreamCenter {
    64     WTF_MAKE_NONCOPYABLE(MediaStreamCenter);
    65     WTF_MAKE_FAST_ALLOCATED;
    66 public:
    67     ~MediaStreamCenter();
     50    virtual ~MediaStreamCenter();
    6851
    6952    static MediaStreamCenter& instance();
    7053
    71     void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>);
     54    virtual void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>) = 0;
    7255
    7356    // FIXME: add a way to mute a MediaStreamSource from the WebKit API layer
    7457
    7558    // Calls from the DOM objects to notify the platform
    76     void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);
    77     void didStopLocalMediaStream(MediaStreamDescriptor*);
    78     void didConstructMediaStream(MediaStreamDescriptor*);
     59    virtual void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) = 0;
     60    virtual void didStopLocalMediaStream(MediaStreamDescriptor*) = 0;
     61    virtual void didConstructMediaStream(MediaStreamDescriptor*) = 0;
    7962
    80     String constructSDP(IceCandidateDescriptor*);
    81     String constructSDP(SessionDescriptionDescriptor*);
     63    virtual String constructSDP(IceCandidateDescriptor*) = 0;
     64    virtual String constructSDP(SessionDescriptionDescriptor*) = 0;
    8265
    83     // Calls from the platform to update the DOM objects
    84     void endLocalMediaStream(MediaStreamDescriptor*);
    85 
    86 private:
     66protected:
    8767    MediaStreamCenter();
    8868
    89 #if PLATFORM(CHROMIUM)
    90     OwnPtr<MediaStreamCenterInternal> m_private;
    91 #endif
     69    void endLocalMediaStream(MediaStreamDescriptor*);
    9270};
    9371
  • trunk/Source/WebCore/platform/mediastream/MediaStreamSourcesQueryClient.h

    r113461 r113462  
    3030 */
    3131
    32 #ifndef MediaStreamCenter_h
    33 #define MediaStreamCenter_h
     32#ifndef MediaStreamSourcesQueryClient_h
     33#define MediaStreamSourcesQueryClient_h
    3434
    3535#if ENABLE(MEDIA_STREAM)
    3636
    3737#include "MediaStreamSource.h"
    38 #include <wtf/OwnPtr.h>
    3938
    4039namespace WebCore {
    41 
    42 #if PLATFORM(CHROMIUM)
    43 class MediaStreamCenterInternal;
    44 #endif
    45 
    46 class IceCandidateDescriptor;
    47 class MediaStreamComponent;
    48 class MediaStreamDescriptor;
    49 class SessionDescriptionDescriptor;
    5040
    5141class MediaStreamSourcesQueryClient : public RefCounted<MediaStreamSourcesQueryClient> {
     
    6151};
    6252
    63 class MediaStreamCenter {
    64     WTF_MAKE_NONCOPYABLE(MediaStreamCenter);
    65     WTF_MAKE_FAST_ALLOCATED;
    66 public:
    67     ~MediaStreamCenter();
    68 
    69     static MediaStreamCenter& instance();
    70 
    71     void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>);
    72 
    73     // FIXME: add a way to mute a MediaStreamSource from the WebKit API layer
    74 
    75     // Calls from the DOM objects to notify the platform
    76     void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);
    77     void didStopLocalMediaStream(MediaStreamDescriptor*);
    78     void didConstructMediaStream(MediaStreamDescriptor*);
    79 
    80     String constructSDP(IceCandidateDescriptor*);
    81     String constructSDP(SessionDescriptionDescriptor*);
    82 
    83     // Calls from the platform to update the DOM objects
    84     void endLocalMediaStream(MediaStreamDescriptor*);
    85 
    86 private:
    87     MediaStreamCenter();
    88 
    89 #if PLATFORM(CHROMIUM)
    90     OwnPtr<MediaStreamCenterInternal> m_private;
    91 #endif
    92 };
    93 
    9453} // namespace WebCore
    9554
    9655#endif // ENABLE(MEDIA_STREAM)
    9756
    98 #endif // MediaStreamCenter_h
     57#endif // MediaStreamSourcesQueryClient_h
  • trunk/Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.cpp

    r112784 r113462  
    3333#if ENABLE(MEDIA_STREAM)
    3434
    35 #include "MediaStreamCenter.h"
     35#include "MediaStreamCenterChromium.h"
    3636
    37 #include "MediaStreamCenterInternal.h"
     37#include "IceCandidateDescriptor.h"
    3838#include "MediaStreamDescriptor.h"
     39#include "MediaStreamSourcesQueryClient.h"
     40#include "SessionDescriptionDescriptor.h"
     41#include <public/Platform.h>
     42#include <public/WebICECandidateDescriptor.h>
     43#include <public/WebMediaStreamCenter.h>
     44#include <public/WebMediaStreamComponent.h>
     45#include <public/WebMediaStreamDescriptor.h>
     46#include <public/WebMediaStreamSourcesRequest.h>
     47#include <public/WebSessionDescriptionDescriptor.h>
     48#include <wtf/MainThread.h>
    3949#include <wtf/PassOwnPtr.h>
    4050
    4151namespace WebCore {
    4252
    43 MediaStreamCenter::MediaStreamCenter()
    44     : m_private(adoptPtr(new MediaStreamCenterInternal(this)))
     53MediaStreamCenter& MediaStreamCenter::instance()
     54{
     55    ASSERT(isMainThread());
     56    DEFINE_STATIC_LOCAL(MediaStreamCenterChromium, center, ());
     57    return center;
     58}
     59
     60MediaStreamCenterChromium::MediaStreamCenterChromium()
     61    : m_private(adoptPtr(WebKit::Platform::current()->createMediaStreamCenter(this)))
    4562{
    4663}
    4764
    48 MediaStreamCenter::~MediaStreamCenter()
     65MediaStreamCenterChromium::~MediaStreamCenterChromium()
    4966{
    5067}
    5168
    52 void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
     69void MediaStreamCenterChromium::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
    5370{
    54     m_private->queryMediaStreamSources(client);
     71    // FIXME: Remove this "short-circuit" and forward to m_private when Chrome and DumpRenderTree has implemented WebMediaStreamCenter.
     72    MediaStreamSourceVector audioSources, videoSources;
     73    client->didCompleteQuery(audioSources, videoSources);
    5574}
    5675
    57 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream,  MediaStreamComponent* component)
     76void MediaStreamCenterChromium::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream,  MediaStreamComponent* component)
    5877{
    59     m_private->didSetMediaStreamTrackEnabled(stream, component);
     78    if (m_private) {
     79        if (component->enabled())
     80            m_private->didEnableMediaStreamTrack(stream, component);
     81        else
     82            m_private->didDisableMediaStreamTrack(stream, component);
     83    }
    6084}
    6185
    62 void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream)
     86void MediaStreamCenterChromium::didStopLocalMediaStream(MediaStreamDescriptor* stream)
    6387{
    64     m_private->didStopLocalMediaStream(stream);
     88    if (m_private)
     89        m_private->didStopLocalMediaStream(stream);
    6590}
    6691
    67 void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor* stream)
     92void MediaStreamCenterChromium::didConstructMediaStream(MediaStreamDescriptor* stream)
    6893{
    69     m_private->didConstructMediaStream(stream);
     94    if (m_private)
     95        m_private->didConstructMediaStream(stream);
    7096}
    7197
    72 String MediaStreamCenter::constructSDP(IceCandidateDescriptor* iceCandidate)
     98String MediaStreamCenterChromium::constructSDP(IceCandidateDescriptor* iceCandidate)
    7399{
    74     return m_private->constructSDP(iceCandidate);
     100    return m_private ? m_private->constructSDP(WebKit::WebICECandidateDescriptor(iceCandidate)) : "";
    75101}
    76102
    77 String MediaStreamCenter::constructSDP(SessionDescriptionDescriptor* sessionDescription)
     103String MediaStreamCenterChromium::constructSDP(SessionDescriptionDescriptor* sessionDescription)
    78104{
    79     return m_private->constructSDP(sessionDescription);
     105    return m_private ? m_private->constructSDP(WebKit::WebSessionDescriptionDescriptor(sessionDescription)) : "";
     106}
     107
     108void MediaStreamCenterChromium::stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor& stream)
     109{
     110    endLocalMediaStream(stream);
    80111}
    81112
  • trunk/Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.h

    r113461 r113462  
    33 *
    44 * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions are
    6  * met:
     5 * modification, are permitted provided that the following conditions
     6 * are met:
    77 *
    8  *     * Redistributions of source code must retain the above copyright
    9  * notice, this list of conditions and the following disclaimer.
    10  *     * Redistributions in binary form must reproduce the above
    11  * copyright notice, this list of conditions and the following disclaimer
    12  * in the documentation and/or other materials provided with the
    13  * distribution.
    14  *     * Neither the name of Google Inc. nor the names of its
    15  * contributors may be used to endorse or promote products derived from
    16  * this software without specific prior written permission.
     8 * 1. Redistributions of source code must retain the above copyright
     9 *    notice, this list of conditions and the following disclaimer.
     10 * 2. Redistributions in binary form must reproduce the above copyright
     11 *   notice, this list of conditions and the following disclaimer
     12 *    in the documentation and/or other materials provided with the
     13 *    distribution.
     14 * 3. Neither the name of Google Inc. nor the names of its contributors
     15 *    may be used to endorse or promote products derived from this
     16 *   software without specific prior written permission.
    1717 *
    1818 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     
    2929 */
    3030
    31 #ifndef MediaStreamCenterInternal_h
    32 #define MediaStreamCenterInternal_h
     31#ifndef MediaStreamCenterChromium_h
     32#define MediaStreamCenterChromium_h
    3333
    3434#if ENABLE(MEDIA_STREAM)
     35
     36#include "MediaStreamCenter.h"
    3537
    3638#include <public/WebMediaStreamCenterClient.h>
     
    4143namespace WebKit {
    4244class WebMediaStreamCenter;
     45class WebMediaStreamDescriptor;
    4346}
    4447
     
    4649
    4750class IceCandidateDescriptor;
    48 class MediaStreamCenter;
    4951class MediaStreamComponent;
    5052class MediaStreamDescriptor;
     
    5254class SessionDescriptionDescriptor;
    5355
    54 class MediaStreamCenterInternal : public WebKit::WebMediaStreamCenterClient {
     56class MediaStreamCenterChromium : public MediaStreamCenter, public WebKit::WebMediaStreamCenterClient {
    5557public:
    56     explicit MediaStreamCenterInternal(MediaStreamCenter*);
    57     ~MediaStreamCenterInternal();
     58    MediaStreamCenterChromium();
     59    ~MediaStreamCenterChromium();
    5860
    59     void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>);
    60     void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);
    61     void didStopLocalMediaStream(MediaStreamDescriptor*);
    62     void didConstructMediaStream(MediaStreamDescriptor*);
    63     String constructSDP(IceCandidateDescriptor*);
    64     String constructSDP(SessionDescriptionDescriptor*);
     61    // MediaStreamCenter
     62    virtual void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>) OVERRIDE;
     63    virtual void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
     64    virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
     65    virtual void didConstructMediaStream(MediaStreamDescriptor*) OVERRIDE;
     66    virtual String constructSDP(IceCandidateDescriptor*) OVERRIDE;
     67    virtual String constructSDP(SessionDescriptionDescriptor*) OVERRIDE;
    6568
    66     // From WebKit::WebMediaStreamCenterClient.
    67     virtual void stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&);
     69    // WebKit::WebMediaStreamCenterClient
     70    virtual void stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE;
    6871
    6972private:
    7073    OwnPtr<WebKit::WebMediaStreamCenter> m_private;
    71     MediaStreamCenter* m_owner;
    7274};
    7375
     
    7678#endif // ENABLE(MEDIA_STREAM)
    7779
    78 #endif // MediaStreamCenterInternal_h
     80#endif // MediaStreamCenterChromium_h
  • trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp

    r113461 r113462  
    11/*
    22 * Copyright (C) 2011 Ericsson AB. All rights reserved.
     3 * Copyright (C) 2012 Google Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3334#if ENABLE(MEDIA_STREAM)
    3435
    35 #include "MediaStreamCenter.h"
     36#include "MediaStreamCenterGStreamer.h"
    3637
    3738#include "IceCandidateDescriptor.h"
    3839#include "MediaStreamDescriptor.h"
     40#include "MediaStreamSourcesQueryClient.h"
    3941#include "SessionDescriptionDescriptor.h"
    40 
    4142#include <wtf/MainThread.h>
    4243
     
    4647{
    4748    ASSERT(isMainThread());
    48     DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ());
     49    DEFINE_STATIC_LOCAL(MediaStreamCenterGStreamer, center, ());
    4950    return center;
    5051}
    5152
    52 void MediaStreamCenter::endLocalMediaStream(MediaStreamDescriptor* streamDescriptor)
    53 {
    54     MediaStreamDescriptorOwner* owner = streamDescriptor->owner();
    55     if (owner)
    56         owner->streamEnded();
    57     else
    58         streamDescriptor->setEnded();
    59 }
    60 
    61 #if !PLATFORM(CHROMIUM)
    62 
    63 // Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter.
    64 
    65 MediaStreamCenter::MediaStreamCenter()
     53MediaStreamCenterGStreamer::MediaStreamCenterGStreamer()
    6654{
    6755}
    6856
    69 MediaStreamCenter::~MediaStreamCenter()
     57MediaStreamCenterGStreamer::~MediaStreamCenterGStreamer()
    7058{
    7159}
    7260
    73 void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
     61void MediaStreamCenterGStreamer::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)
    7462{
    7563    MediaStreamSourceVector audioSources, videoSources;
     
    7765}
    7866
    79 void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
     67void MediaStreamCenterGStreamer::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)
    8068{
    8169}
    8270
    83 void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor*)
     71void MediaStreamCenterGStreamer::didStopLocalMediaStream(MediaStreamDescriptor*)
    8472{
    8573}
    8674
    87 void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor*)
     75void MediaStreamCenterGStreamer::didConstructMediaStream(MediaStreamDescriptor*)
    8876{
    8977}
    9078
    91 String MediaStreamCenter::constructSDP(IceCandidateDescriptor*)
     79String MediaStreamCenterGStreamer::constructSDP(IceCandidateDescriptor*)
    9280{
    9381    return "";
    9482}
    9583
    96 String MediaStreamCenter::constructSDP(SessionDescriptionDescriptor*)
     84String MediaStreamCenterGStreamer::constructSDP(SessionDescriptionDescriptor*)
    9785{
    9886    return "";
    9987}
    10088
    101 #endif // !PLATFORM(CHROMIUM)
    102 
    10389} // namespace WebCore
    10490
  • trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h

    r113461 r113462  
    3030 */
    3131
    32 #ifndef MediaStreamCenter_h
    33 #define MediaStreamCenter_h
     32#ifndef MediaStreamCenterGStreamer_h
     33#define MediaStreamCenterGStreamer_h
    3434
    3535#if ENABLE(MEDIA_STREAM)
    3636
    37 #include "MediaStreamSource.h"
    38 #include <wtf/OwnPtr.h>
     37#include "MediaStreamCenter.h"
     38
     39#include <wtf/PassRefPtr.h>
     40#include <wtf/text/WTFString.h>
    3941
    4042namespace WebCore {
    41 
    42 #if PLATFORM(CHROMIUM)
    43 class MediaStreamCenterInternal;
    44 #endif
    4543
    4644class IceCandidateDescriptor;
    4745class MediaStreamComponent;
    4846class MediaStreamDescriptor;
     47class MediaStreamSourcesQueryClient;
    4948class SessionDescriptionDescriptor;
    5049
    51 class MediaStreamSourcesQueryClient : public RefCounted<MediaStreamSourcesQueryClient> {
     50class MediaStreamCenterGStreamer : public MediaStreamCenter {
    5251public:
    53     virtual ~MediaStreamSourcesQueryClient() { }
     52    MediaStreamCenterGStreamer();
     53    ~MediaStreamCenterGStreamer();
    5454
    55     virtual bool audio() const = 0;
    56     virtual bool video() const = 0;
    57     virtual bool cameraPreferenceUser() const = 0;
    58     virtual bool cameraPreferenceEnvironment() const = 0;
    59 
    60     virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0;
    61 };
    62 
    63 class MediaStreamCenter {
    64     WTF_MAKE_NONCOPYABLE(MediaStreamCenter);
    65     WTF_MAKE_FAST_ALLOCATED;
    66 public:
    67     ~MediaStreamCenter();
    68 
    69     static MediaStreamCenter& instance();
    70 
    71     void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>);
    72 
    73     // FIXME: add a way to mute a MediaStreamSource from the WebKit API layer
    74 
    75     // Calls from the DOM objects to notify the platform
    76     void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);
    77     void didStopLocalMediaStream(MediaStreamDescriptor*);
    78     void didConstructMediaStream(MediaStreamDescriptor*);
    79 
    80     String constructSDP(IceCandidateDescriptor*);
    81     String constructSDP(SessionDescriptionDescriptor*);
    82 
    83     // Calls from the platform to update the DOM objects
    84     void endLocalMediaStream(MediaStreamDescriptor*);
    85 
    86 private:
    87     MediaStreamCenter();
    88 
    89 #if PLATFORM(CHROMIUM)
    90     OwnPtr<MediaStreamCenterInternal> m_private;
    91 #endif
     55    // MediaStreamCenter
     56    virtual void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>) OVERRIDE;
     57    virtual void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
     58    virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
     59    virtual void didConstructMediaStream(MediaStreamDescriptor*) OVERRIDE;
     60    virtual String constructSDP(IceCandidateDescriptor*) OVERRIDE;
     61    virtual String constructSDP(SessionDescriptionDescriptor*) OVERRIDE;
    9262};
    9363
     
    9666#endif // ENABLE(MEDIA_STREAM)
    9767
    98 #endif // MediaStreamCenter_h
     68#endif // MediaStreamCenterGStreamer_h
Note: See TracChangeset for help on using the changeset viewer.