OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const String& id, | 53 const String& id, |
54 const MediaStreamComponentVector& audioComponents, | 54 const MediaStreamComponentVector& audioComponents, |
55 const MediaStreamComponentVector& videoComponents) { | 55 const MediaStreamComponentVector& videoComponents) { |
56 return new MediaStreamDescriptor(id, audioComponents, videoComponents); | 56 return new MediaStreamDescriptor(id, audioComponents, videoComponents); |
57 } | 57 } |
58 | 58 |
59 void MediaStreamDescriptor::addComponent(MediaStreamComponent* component) { | 59 void MediaStreamDescriptor::addComponent(MediaStreamComponent* component) { |
60 switch (component->source()->type()) { | 60 switch (component->source()->type()) { |
61 case MediaStreamSource::TypeAudio: | 61 case MediaStreamSource::TypeAudio: |
62 if (m_audioComponents.find(component) == kNotFound) | 62 if (m_audioComponents.find(component) == kNotFound) |
63 m_audioComponents.append(component); | 63 m_audioComponents.push_back(component); |
64 break; | 64 break; |
65 case MediaStreamSource::TypeVideo: | 65 case MediaStreamSource::TypeVideo: |
66 if (m_videoComponents.find(component) == kNotFound) | 66 if (m_videoComponents.find(component) == kNotFound) |
67 m_videoComponents.append(component); | 67 m_videoComponents.push_back(component); |
68 break; | 68 break; |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 void MediaStreamDescriptor::removeComponent(MediaStreamComponent* component) { | 72 void MediaStreamDescriptor::removeComponent(MediaStreamComponent* component) { |
73 size_t pos = kNotFound; | 73 size_t pos = kNotFound; |
74 switch (component->source()->type()) { | 74 switch (component->source()->type()) { |
75 case MediaStreamSource::TypeAudio: | 75 case MediaStreamSource::TypeAudio: |
76 pos = m_audioComponents.find(component); | 76 pos = m_audioComponents.find(component); |
77 if (pos != kNotFound) | 77 if (pos != kNotFound) |
(...skipping 21 matching lines...) Expand all Loading... |
99 removeComponent(component); | 99 removeComponent(component); |
100 } | 100 } |
101 | 101 |
102 MediaStreamDescriptor::MediaStreamDescriptor( | 102 MediaStreamDescriptor::MediaStreamDescriptor( |
103 const String& id, | 103 const String& id, |
104 const MediaStreamSourceVector& audioSources, | 104 const MediaStreamSourceVector& audioSources, |
105 const MediaStreamSourceVector& videoSources) | 105 const MediaStreamSourceVector& videoSources) |
106 : m_client(nullptr), m_id(id), m_active(true) { | 106 : m_client(nullptr), m_id(id), m_active(true) { |
107 ASSERT(m_id.length()); | 107 ASSERT(m_id.length()); |
108 for (size_t i = 0; i < audioSources.size(); i++) | 108 for (size_t i = 0; i < audioSources.size(); i++) |
109 m_audioComponents.append(MediaStreamComponent::create(audioSources[i])); | 109 m_audioComponents.push_back(MediaStreamComponent::create(audioSources[i])); |
110 | 110 |
111 for (size_t i = 0; i < videoSources.size(); i++) | 111 for (size_t i = 0; i < videoSources.size(); i++) |
112 m_videoComponents.append(MediaStreamComponent::create(videoSources[i])); | 112 m_videoComponents.push_back(MediaStreamComponent::create(videoSources[i])); |
113 } | 113 } |
114 | 114 |
115 MediaStreamDescriptor::MediaStreamDescriptor( | 115 MediaStreamDescriptor::MediaStreamDescriptor( |
116 const String& id, | 116 const String& id, |
117 const MediaStreamComponentVector& audioComponents, | 117 const MediaStreamComponentVector& audioComponents, |
118 const MediaStreamComponentVector& videoComponents) | 118 const MediaStreamComponentVector& videoComponents) |
119 : m_client(nullptr), m_id(id), m_active(true) { | 119 : m_client(nullptr), m_id(id), m_active(true) { |
120 ASSERT(m_id.length()); | 120 ASSERT(m_id.length()); |
121 for (MediaStreamComponentVector::const_iterator iter = | 121 for (MediaStreamComponentVector::const_iterator iter = |
122 audioComponents.begin(); | 122 audioComponents.begin(); |
123 iter != audioComponents.end(); ++iter) | 123 iter != audioComponents.end(); ++iter) |
124 m_audioComponents.append((*iter)); | 124 m_audioComponents.push_back((*iter)); |
125 for (MediaStreamComponentVector::const_iterator iter = | 125 for (MediaStreamComponentVector::const_iterator iter = |
126 videoComponents.begin(); | 126 videoComponents.begin(); |
127 iter != videoComponents.end(); ++iter) | 127 iter != videoComponents.end(); ++iter) |
128 m_videoComponents.append((*iter)); | 128 m_videoComponents.push_back((*iter)); |
129 } | 129 } |
130 | 130 |
131 DEFINE_TRACE(MediaStreamDescriptor) { | 131 DEFINE_TRACE(MediaStreamDescriptor) { |
132 visitor->trace(m_audioComponents); | 132 visitor->trace(m_audioComponents); |
133 visitor->trace(m_videoComponents); | 133 visitor->trace(m_videoComponents); |
134 visitor->trace(m_client); | 134 visitor->trace(m_client); |
135 } | 135 } |
136 | 136 |
137 } // namespace blink | 137 } // namespace blink |
OLD | NEW |