Changeset 113462 in webkit
- Timestamp:
- Apr 6, 2012 11:23:56 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 12 edited
- 3 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r113461 r113462 1 2012-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 1 70 2012-04-05 Simon Fraser <simon.fraser@apple.com> 2 71 -
trunk/Source/WebCore/GNUmakefile.am
r112658 r113462 69 69 -I$(srcdir)/Source/WebCore/platform/leveldb \ 70 70 -I$(srcdir)/Source/WebCore/platform/mediastream \ 71 -I$(srcdir)/Source/WebCore/platform/mediastream/gstreamer \ 71 72 -I$(srcdir)/Source/WebCore/platform/mock \ 72 73 -I$(srcdir)/Source/WebCore/platform/network \ -
trunk/Source/WebCore/GNUmakefile.list.am
r113448 r113462 3385 3385 Source/WebCore/platform/mediastream/SessionDescriptionDescriptor.h \ 3386 3386 Source/WebCore/platform/mediastream/gstreamer/DeprecatedPeerConnectionHandler.cpp \ 3387 Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp \ 3388 Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h \ 3387 3389 Source/WebCore/platform/mock/DeviceOrientationClientMock.cpp \ 3388 3390 Source/WebCore/platform/mock/DeviceOrientationClientMock.h \ -
trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
r108383 r113462 83 83 84 84 if (m_streamDescriptor->ended()) 85 return; 85 return; 86 86 87 87 MediaStreamCenter::instance().didSetMediaStreamTrackEnabled(m_streamDescriptor.get(), m_component.get()); -
trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
r108437 r113462 36 36 37 37 #include "LocalMediaStream.h" 38 #include "MediaStreamCenter.h" 38 39 #include "SpaceSplitString.h" 39 40 #include "UserMediaController.h" -
trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h
r108437 r113462 35 35 36 36 #include "ActiveDOMObject.h" 37 #include "MediaStreamCenter.h"38 37 #include "MediaStreamSource.h" 38 #include "MediaStreamSourcesQueryClient.h" 39 39 #include "NavigatorUserMediaErrorCallback.h" 40 40 #include "NavigatorUserMediaSuccessCallback.h" -
trunk/Source/WebCore/WebCore.gyp/WebCore.gyp
r113422 r113462 125 125 '../platform/leveldb', 126 126 '../platform/mediastream', 127 '../platform/mediastream/chromium', 127 128 '../platform/mock', 128 129 '../platform/network', -
trunk/Source/WebCore/WebCore.gypi
r113448 r113462 442 442 'platform/mediastream/chromium/DeprecatedPeerConnectionHandlerInternal.h', 443 443 'platform/mediastream/chromium/MediaStreamCenterChromium.cpp', 444 'platform/mediastream/chromium/MediaStreamCenterInternal.cpp', 445 'platform/mediastream/chromium/MediaStreamCenterInternal.h', 444 'platform/mediastream/chromium/MediaStreamCenterChromium.h', 446 445 'platform/mediastream/chromium/PeerConnection00Handler.cpp', 447 446 'platform/mediastream/chromium/PeerConnection00HandlerInternal.cpp', -
trunk/Source/WebCore/platform/chromium/support/WebMediaStreamSourcesRequest.cpp
r113218 r113462 35 35 #include <public/WebMediaStreamSourcesRequest.h> 36 36 37 #include "MediaStreamCenter.h"38 37 #include "MediaStreamSource.h" 38 #include "MediaStreamSourcesQueryClient.h" 39 39 #include <public/WebMediaStreamSource.h> 40 40 #include <public/WebVector.h> -
trunk/Source/WebCore/platform/mediastream/MediaStreamCenter.cpp
r111874 r113462 1 1 /* 2 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 35 36 #include "MediaStreamCenter.h" 36 37 37 #include "IceCandidateDescriptor.h"38 38 #include "MediaStreamDescriptor.h" 39 #include "SessionDescriptionDescriptor.h"40 41 #include <wtf/MainThread.h>42 39 43 40 namespace WebCore { 44 41 45 MediaStreamCenter & MediaStreamCenter::instance()42 MediaStreamCenter::MediaStreamCenter() 46 43 { 47 ASSERT(isMainThread()); 48 DEFINE_STATIC_LOCAL(MediaStreamCenter, center, ()); 49 return center; 44 } 45 46 MediaStreamCenter::~MediaStreamCenter() 47 { 50 48 } 51 49 … … 59 57 } 60 58 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 103 59 } // namespace WebCore 104 60 -
trunk/Source/WebCore/platform/mediastream/MediaStreamCenter.h
r111577 r113462 35 35 #if ENABLE(MEDIA_STREAM) 36 36 37 #include "MediaStreamSource.h"38 #include <wtf/ OwnPtr.h>37 #include <wtf/PassRefPtr.h> 38 #include <wtf/text/WTFString.h> 39 39 40 40 namespace WebCore { 41 42 #if PLATFORM(CHROMIUM)43 class MediaStreamCenterInternal;44 #endif45 41 46 42 class IceCandidateDescriptor; 47 43 class MediaStreamComponent; 48 44 class MediaStreamDescriptor; 45 class MediaStreamSourcesQueryClient; 49 46 class SessionDescriptionDescriptor; 50 47 51 class MediaStream SourcesQueryClient : public RefCounted<MediaStreamSourcesQueryClient>{48 class MediaStreamCenter { 52 49 public: 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(); 68 51 69 52 static MediaStreamCenter& instance(); 70 53 71 v oid queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>);54 virtual void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>) = 0; 72 55 73 56 // FIXME: add a way to mute a MediaStreamSource from the WebKit API layer 74 57 75 58 // Calls from the DOM objects to notify the platform 76 v oid didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*);77 v oid didStopLocalMediaStream(MediaStreamDescriptor*);78 v oid didConstructMediaStream(MediaStreamDescriptor*);59 virtual void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) = 0; 60 virtual void didStopLocalMediaStream(MediaStreamDescriptor*) = 0; 61 virtual void didConstructMediaStream(MediaStreamDescriptor*) = 0; 79 62 80 String constructSDP(IceCandidateDescriptor*);81 String constructSDP(SessionDescriptionDescriptor*);63 virtual String constructSDP(IceCandidateDescriptor*) = 0; 64 virtual String constructSDP(SessionDescriptionDescriptor*) = 0; 82 65 83 // Calls from the platform to update the DOM objects 84 void endLocalMediaStream(MediaStreamDescriptor*); 85 86 private: 66 protected: 87 67 MediaStreamCenter(); 88 68 89 #if PLATFORM(CHROMIUM) 90 OwnPtr<MediaStreamCenterInternal> m_private; 91 #endif 69 void endLocalMediaStream(MediaStreamDescriptor*); 92 70 }; 93 71 -
trunk/Source/WebCore/platform/mediastream/MediaStreamSourcesQueryClient.h
r113461 r113462 30 30 */ 31 31 32 #ifndef MediaStream Center_h33 #define MediaStream Center_h32 #ifndef MediaStreamSourcesQueryClient_h 33 #define MediaStreamSourcesQueryClient_h 34 34 35 35 #if ENABLE(MEDIA_STREAM) 36 36 37 37 #include "MediaStreamSource.h" 38 #include <wtf/OwnPtr.h>39 38 40 39 namespace WebCore { 41 42 #if PLATFORM(CHROMIUM)43 class MediaStreamCenterInternal;44 #endif45 46 class IceCandidateDescriptor;47 class MediaStreamComponent;48 class MediaStreamDescriptor;49 class SessionDescriptionDescriptor;50 40 51 41 class MediaStreamSourcesQueryClient : public RefCounted<MediaStreamSourcesQueryClient> { … … 61 51 }; 62 52 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 layer74 75 // Calls from the DOM objects to notify the platform76 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 objects84 void endLocalMediaStream(MediaStreamDescriptor*);85 86 private:87 MediaStreamCenter();88 89 #if PLATFORM(CHROMIUM)90 OwnPtr<MediaStreamCenterInternal> m_private;91 #endif92 };93 94 53 } // namespace WebCore 95 54 96 55 #endif // ENABLE(MEDIA_STREAM) 97 56 98 #endif // MediaStream Center_h57 #endif // MediaStreamSourcesQueryClient_h -
trunk/Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.cpp
r112784 r113462 33 33 #if ENABLE(MEDIA_STREAM) 34 34 35 #include "MediaStreamCenter .h"35 #include "MediaStreamCenterChromium.h" 36 36 37 #include " MediaStreamCenterInternal.h"37 #include "IceCandidateDescriptor.h" 38 38 #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> 39 49 #include <wtf/PassOwnPtr.h> 40 50 41 51 namespace WebCore { 42 52 43 MediaStreamCenter::MediaStreamCenter() 44 : m_private(adoptPtr(new MediaStreamCenterInternal(this))) 53 MediaStreamCenter& MediaStreamCenter::instance() 54 { 55 ASSERT(isMainThread()); 56 DEFINE_STATIC_LOCAL(MediaStreamCenterChromium, center, ()); 57 return center; 58 } 59 60 MediaStreamCenterChromium::MediaStreamCenterChromium() 61 : m_private(adoptPtr(WebKit::Platform::current()->createMediaStreamCenter(this))) 45 62 { 46 63 } 47 64 48 MediaStreamCenter ::~MediaStreamCenter()65 MediaStreamCenterChromium::~MediaStreamCenterChromium() 49 66 { 50 67 } 51 68 52 void MediaStreamCenter ::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)69 void MediaStreamCenterChromium::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client) 53 70 { 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); 55 74 } 56 75 57 void MediaStreamCenter ::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component)76 void MediaStreamCenterChromium::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component) 58 77 { 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 } 60 84 } 61 85 62 void MediaStreamCenter ::didStopLocalMediaStream(MediaStreamDescriptor* stream)86 void MediaStreamCenterChromium::didStopLocalMediaStream(MediaStreamDescriptor* stream) 63 87 { 64 m_private->didStopLocalMediaStream(stream); 88 if (m_private) 89 m_private->didStopLocalMediaStream(stream); 65 90 } 66 91 67 void MediaStreamCenter ::didConstructMediaStream(MediaStreamDescriptor* stream)92 void MediaStreamCenterChromium::didConstructMediaStream(MediaStreamDescriptor* stream) 68 93 { 69 m_private->didConstructMediaStream(stream); 94 if (m_private) 95 m_private->didConstructMediaStream(stream); 70 96 } 71 97 72 String MediaStreamCenter ::constructSDP(IceCandidateDescriptor* iceCandidate)98 String MediaStreamCenterChromium::constructSDP(IceCandidateDescriptor* iceCandidate) 73 99 { 74 return m_private ->constructSDP(iceCandidate);100 return m_private ? m_private->constructSDP(WebKit::WebICECandidateDescriptor(iceCandidate)) : ""; 75 101 } 76 102 77 String MediaStreamCenter ::constructSDP(SessionDescriptionDescriptor* sessionDescription)103 String MediaStreamCenterChromium::constructSDP(SessionDescriptionDescriptor* sessionDescription) 78 104 { 79 return m_private->constructSDP(sessionDescription); 105 return m_private ? m_private->constructSDP(WebKit::WebSessionDescriptionDescriptor(sessionDescription)) : ""; 106 } 107 108 void MediaStreamCenterChromium::stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor& stream) 109 { 110 endLocalMediaStream(stream); 80 111 } 81 112 -
trunk/Source/WebCore/platform/mediastream/chromium/MediaStreamCenterChromium.h
r113461 r113462 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are6 * met:5 * modification, are permitted provided that the following conditions 6 * are met: 7 7 * 8 * *Redistributions of source code must retain the above copyright9 * notice, this list of conditions and the following disclaimer.10 * * Redistributions in binary form must reproduce the above11 * copyrightnotice, this list of conditions and the following disclaimer12 * in the documentation and/or other materials provided with the13 * distribution.14 * * Neither the name of Google Inc. nor the names of its15 * contributors may be used to endorse or promote products derived from16 * thissoftware 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. 17 17 * 18 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS … … 29 29 */ 30 30 31 #ifndef MediaStreamCenter Internal_h32 #define MediaStreamCenter Internal_h31 #ifndef MediaStreamCenterChromium_h 32 #define MediaStreamCenterChromium_h 33 33 34 34 #if ENABLE(MEDIA_STREAM) 35 36 #include "MediaStreamCenter.h" 35 37 36 38 #include <public/WebMediaStreamCenterClient.h> … … 41 43 namespace WebKit { 42 44 class WebMediaStreamCenter; 45 class WebMediaStreamDescriptor; 43 46 } 44 47 … … 46 49 47 50 class IceCandidateDescriptor; 48 class MediaStreamCenter;49 51 class MediaStreamComponent; 50 52 class MediaStreamDescriptor; … … 52 54 class SessionDescriptionDescriptor; 53 55 54 class MediaStreamCenter Internal :public WebKit::WebMediaStreamCenterClient {56 class MediaStreamCenterChromium : public MediaStreamCenter, public WebKit::WebMediaStreamCenterClient { 55 57 public: 56 explicit MediaStreamCenterInternal(MediaStreamCenter*);57 ~MediaStreamCenter Internal();58 MediaStreamCenterChromium(); 59 ~MediaStreamCenterChromium(); 58 60 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; 65 68 66 // From WebKit::WebMediaStreamCenterClient.67 virtual void stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&) ;69 // WebKit::WebMediaStreamCenterClient 70 virtual void stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE; 68 71 69 72 private: 70 73 OwnPtr<WebKit::WebMediaStreamCenter> m_private; 71 MediaStreamCenter* m_owner;72 74 }; 73 75 … … 76 78 #endif // ENABLE(MEDIA_STREAM) 77 79 78 #endif // MediaStreamCenter Internal_h80 #endif // MediaStreamCenterChromium_h -
trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp
r113461 r113462 1 1 /* 2 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 33 34 #if ENABLE(MEDIA_STREAM) 34 35 35 #include "MediaStreamCenter .h"36 #include "MediaStreamCenterGStreamer.h" 36 37 37 38 #include "IceCandidateDescriptor.h" 38 39 #include "MediaStreamDescriptor.h" 40 #include "MediaStreamSourcesQueryClient.h" 39 41 #include "SessionDescriptionDescriptor.h" 40 41 42 #include <wtf/MainThread.h> 42 43 … … 46 47 { 47 48 ASSERT(isMainThread()); 48 DEFINE_STATIC_LOCAL(MediaStreamCenter , center, ());49 DEFINE_STATIC_LOCAL(MediaStreamCenterGStreamer, center, ()); 49 50 return center; 50 51 } 51 52 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() 53 MediaStreamCenterGStreamer::MediaStreamCenterGStreamer() 66 54 { 67 55 } 68 56 69 MediaStreamCenter ::~MediaStreamCenter()57 MediaStreamCenterGStreamer::~MediaStreamCenterGStreamer() 70 58 { 71 59 } 72 60 73 void MediaStreamCenter ::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client)61 void MediaStreamCenterGStreamer::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client) 74 62 { 75 63 MediaStreamSourceVector audioSources, videoSources; … … 77 65 } 78 66 79 void MediaStreamCenter ::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*)67 void MediaStreamCenterGStreamer::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) 80 68 { 81 69 } 82 70 83 void MediaStreamCenter ::didStopLocalMediaStream(MediaStreamDescriptor*)71 void MediaStreamCenterGStreamer::didStopLocalMediaStream(MediaStreamDescriptor*) 84 72 { 85 73 } 86 74 87 void MediaStreamCenter ::didConstructMediaStream(MediaStreamDescriptor*)75 void MediaStreamCenterGStreamer::didConstructMediaStream(MediaStreamDescriptor*) 88 76 { 89 77 } 90 78 91 String MediaStreamCenter ::constructSDP(IceCandidateDescriptor*)79 String MediaStreamCenterGStreamer::constructSDP(IceCandidateDescriptor*) 92 80 { 93 81 return ""; 94 82 } 95 83 96 String MediaStreamCenter ::constructSDP(SessionDescriptionDescriptor*)84 String MediaStreamCenterGStreamer::constructSDP(SessionDescriptionDescriptor*) 97 85 { 98 86 return ""; 99 87 } 100 88 101 #endif // !PLATFORM(CHROMIUM)102 103 89 } // namespace WebCore 104 90 -
trunk/Source/WebCore/platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h
r113461 r113462 30 30 */ 31 31 32 #ifndef MediaStreamCenter _h33 #define MediaStreamCenter _h32 #ifndef MediaStreamCenterGStreamer_h 33 #define MediaStreamCenterGStreamer_h 34 34 35 35 #if ENABLE(MEDIA_STREAM) 36 36 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> 39 41 40 42 namespace WebCore { 41 42 #if PLATFORM(CHROMIUM)43 class MediaStreamCenterInternal;44 #endif45 43 46 44 class IceCandidateDescriptor; 47 45 class MediaStreamComponent; 48 46 class MediaStreamDescriptor; 47 class MediaStreamSourcesQueryClient; 49 48 class SessionDescriptionDescriptor; 50 49 51 class MediaStream SourcesQueryClient : public RefCounted<MediaStreamSourcesQueryClient>{50 class MediaStreamCenterGStreamer : public MediaStreamCenter { 52 51 public: 53 virtual ~MediaStreamSourcesQueryClient() { } 52 MediaStreamCenterGStreamer(); 53 ~MediaStreamCenterGStreamer(); 54 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(); 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; 92 62 }; 93 63 … … 96 66 #endif // ENABLE(MEDIA_STREAM) 97 67 98 #endif // MediaStreamCenter _h68 #endif // MediaStreamCenterGStreamer_h
Note: See TracChangeset
for help on using the changeset viewer.