Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: Source/core/platform/mediastream/MediaStreamDescriptor.cpp

Issue 16753003: Revert "Remove MediaStreamDescriptor and call/use WebMediaStream directly" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. 2 * Copyright (C) 2011 Ericsson AB. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 13 matching lines...) Expand all
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #include "config.h" 32 #include "config.h"
33 33
34 #include "core/platform/chromium/support/WebMediaStreamPrivate.h" 34 #include "core/platform/mediastream/MediaStreamDescriptor.h"
35 35
36 #include "core/platform/UUID.h" 36 #include "core/platform/UUID.h"
37 #include "core/platform/mediastream/MediaStreamComponent.h" 37 #include "core/platform/mediastream/MediaStreamComponent.h"
38 #include "core/platform/mediastream/MediaStreamSource.h" 38 #include "core/platform/mediastream/MediaStreamSource.h"
39 #include "wtf/RefCounted.h" 39 #include <wtf/RefCounted.h>
40 #include "wtf/Vector.h" 40 #include <wtf/Vector.h>
41 41
42 namespace WebKit { 42 namespace WebCore {
43 43
44 PassRefPtr<WebMediaStreamPrivate> WebMediaStreamPrivate::create(const WebCore::M ediaStreamSourceVector& audioSources, const WebCore::MediaStreamSourceVector& vi deoSources) 44 PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const MediaStrea mSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
45 { 45 {
46 return adoptRef(new WebMediaStreamPrivate(WebCore::createCanonicalUUIDString (), audioSources, videoSources)); 46 return adoptRef(new MediaStreamDescriptor(createCanonicalUUIDString(), audio Sources, videoSources));
47 } 47 }
48 48
49 PassRefPtr<WebMediaStreamPrivate> WebMediaStreamPrivate::create(const String& id , const WebCore::MediaStreamComponentVector& audioComponents, const WebCore::Med iaStreamComponentVector& videoComponents) 49 PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const String& id , const MediaStreamComponentVector& audioComponents, const MediaStreamComponentV ector& videoComponents)
50 { 50 {
51 return adoptRef(new WebMediaStreamPrivate(id, audioComponents, videoComponen ts)); 51 return adoptRef(new MediaStreamDescriptor(id, audioComponents, videoComponen ts));
52 } 52 }
53 53
54 void WebMediaStreamPrivate::addComponent(WebCore::MediaStreamComponent* componen t) 54 void MediaStreamDescriptor::addComponent(PassRefPtr<MediaStreamComponent> compon ent)
55 { 55 {
56 switch (component->source()->type()) { 56 switch (component->source()->type()) {
57 case WebCore::MediaStreamSource::TypeAudio: 57 case MediaStreamSource::TypeAudio:
58 if (m_audioComponents.find(component) == notFound) 58 if (m_audioComponents.find(component) == notFound)
59 m_audioComponents.append(component); 59 m_audioComponents.append(component);
60 break; 60 break;
61 case WebCore::MediaStreamSource::TypeVideo: 61 case MediaStreamSource::TypeVideo:
62 if (m_videoComponents.find(component) == notFound) 62 if (m_videoComponents.find(component) == notFound)
63 m_videoComponents.append(component); 63 m_videoComponents.append(component);
64 break; 64 break;
65 } 65 }
66 } 66 }
67 67
68 void WebMediaStreamPrivate::removeComponent(WebCore::MediaStreamComponent* compo nent) 68 void MediaStreamDescriptor::removeComponent(PassRefPtr<MediaStreamComponent> com ponent)
69 { 69 {
70 size_t pos = notFound; 70 size_t pos = notFound;
71 switch (component->source()->type()) { 71 switch (component->source()->type()) {
72 case WebCore::MediaStreamSource::TypeAudio: 72 case MediaStreamSource::TypeAudio:
73 pos = m_audioComponents.find(component); 73 pos = m_audioComponents.find(component);
74 if (pos != notFound) 74 if (pos != notFound)
75 m_audioComponents.remove(pos); 75 m_audioComponents.remove(pos);
76 break; 76 break;
77 case WebCore::MediaStreamSource::TypeVideo: 77 case MediaStreamSource::TypeVideo:
78 pos = m_videoComponents.find(component); 78 pos = m_videoComponents.find(component);
79 if (pos != notFound) 79 if (pos != notFound)
80 m_videoComponents.remove(pos); 80 m_videoComponents.remove(pos);
81 break; 81 break;
82 } 82 }
83 } 83 }
84 84
85 void WebMediaStreamPrivate::addRemoteTrack(WebCore::MediaStreamComponent* compon ent) 85 void MediaStreamDescriptor::addRemoteTrack(MediaStreamComponent* component)
86 { 86 {
87 if (m_client) 87 if (m_client)
88 m_client->addRemoteTrack(component); 88 m_client->addRemoteTrack(component);
89 else 89 else
90 addComponent(component); 90 addComponent(component);
91 } 91 }
92 92
93 void WebMediaStreamPrivate::removeRemoteTrack(WebCore::MediaStreamComponent* com ponent) 93 void MediaStreamDescriptor::removeRemoteTrack(MediaStreamComponent* component)
94 { 94 {
95 if (m_client) 95 if (m_client)
96 m_client->removeRemoteTrack(component); 96 m_client->removeRemoteTrack(component);
97 else 97 else
98 removeComponent(component); 98 removeComponent(component);
99 } 99 }
100 100
101 WebMediaStreamPrivate::WebMediaStreamPrivate(const String& id, const WebCore::Me diaStreamSourceVector& audioSources, const WebCore::MediaStreamSourceVector& vid eoSources) 101 MediaStreamDescriptor::MediaStreamDescriptor(const String& id, const MediaStream SourceVector& audioSources, const MediaStreamSourceVector& videoSources)
102 : m_client(0) 102 : m_client(0)
103 , m_id(id) 103 , m_id(id)
104 , m_ended(false) 104 , m_ended(false)
105 { 105 {
106 ASSERT(m_id.length()); 106 ASSERT(m_id.length());
107
108 for (size_t i = 0; i < audioSources.size(); i++) 107 for (size_t i = 0; i < audioSources.size(); i++)
109 m_audioComponents.append(WebCore::MediaStreamComponent::create(WebMediaS tream(this), audioSources[i])); 108 m_audioComponents.append(MediaStreamComponent::create(this, audioSources [i]));
110 109
111 for (size_t i = 0; i < videoSources.size(); i++) 110 for (size_t i = 0; i < videoSources.size(); i++)
112 m_videoComponents.append(WebCore::MediaStreamComponent::create(WebMediaS tream(this), videoSources[i])); 111 m_videoComponents.append(MediaStreamComponent::create(this, videoSources [i]));
113 } 112 }
114 113
115 WebMediaStreamPrivate::WebMediaStreamPrivate(const String& id, const WebCore::Me diaStreamComponentVector& audioComponents, const WebCore::MediaStreamComponentVe ctor& videoComponents) 114 MediaStreamDescriptor::MediaStreamDescriptor(const String& id, const MediaStream ComponentVector& audioComponents, const MediaStreamComponentVector& videoCompone nts)
116 : m_client(0) 115 : m_client(0)
117 , m_id(id) 116 , m_id(id)
118 , m_ended(false) 117 , m_ended(false)
119 { 118 {
120 ASSERT(m_id.length()); 119 ASSERT(m_id.length());
121 for (WebCore::MediaStreamComponentVector::const_iterator iter = audioCompone nts.begin(); iter != audioComponents.end(); ++iter) { 120 for (MediaStreamComponentVector::const_iterator iter = audioComponents.begin (); iter != audioComponents.end(); ++iter) {
122 (*iter)->setStream(this); 121 (*iter)->setStream(this);
123 m_audioComponents.append((*iter)); 122 m_audioComponents.append((*iter));
124 } 123 }
125 for (WebCore::MediaStreamComponentVector::const_iterator iter = videoCompone nts.begin(); iter != videoComponents.end(); ++iter) { 124 for (MediaStreamComponentVector::const_iterator iter = videoComponents.begin (); iter != videoComponents.end(); ++iter) {
126 (*iter)->setStream(this); 125 (*iter)->setStream(this);
127 m_videoComponents.append((*iter)); 126 m_videoComponents.append((*iter));
128 } 127 }
129 } 128 }
130 129
131 } // namespace WebKit 130 } // namespace WebCore
131
OLDNEW
« no previous file with comments | « Source/core/platform/mediastream/MediaStreamDescriptor.h ('k') | Source/core/platform/mediastream/RTCPeerConnectionHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698