Changeset 167750 in webkit
- Timestamp:
- Apr 23, 2014, 11:37:51 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r167732 r167750 1 2014-04-23 Praveen R Jadhav <praveen.j@samsung.com> 2 3 [MediaStream] Implement MediaStream active attribute 4 https://bugs.webkit.org/show_bug.cgi?id=131973 5 6 Reviewed by Eric Carlson. 7 8 MediaStream .onended attribute will be replaced with .active attribute. 9 Patch updates the test case to verify the .active attribute. 10 11 * fast/mediastream/MediaStream-add-remove-tracks-expected.txt: 12 * fast/mediastream/MediaStream-add-remove-tracks.html: 13 1 14 2014-04-23 Alexey Proskuryakov <ap@apple.com> 2 15 -
trunk/LayoutTests/fast/mediastream/MediaStream-add-remove-tracks-expected.txt
r158220 r167750 4 4 5 5 6 PASS stream1.active is true 6 7 PASS stream1.getAudioTracks().length is 1 7 8 PASS stream1.getVideoTracks().length is 1 9 PASS stream2.active is true 8 10 PASS stream2.getAudioTracks().length is 1 9 11 PASS stream2.getVideoTracks().length is 1 … … 51 53 PASS stream2.addTrack(audioTrack) threw exception Error: InvalidStateError: DOM Exception 11. 52 54 PASS stream2.removeTrack(audioTrack) threw exception Error: InvalidStateError: DOM Exception 11. 55 Stream2 is inactive. 53 56 PASS successfullyParsed is true 54 57 -
trunk/LayoutTests/fast/mediastream/MediaStream-add-remove-tracks.html
r158987 r167750 51 51 } 52 52 53 function shouldFireActive() { 54 debug("Stream2 is active."); 55 finishJSTest(); 56 } 57 58 function shouldFireInActive() { 59 debug("Stream2 is inactive."); 60 finishJSTest(); 61 } 62 53 63 function gotStream2(s) { 54 64 stream2 = s; 55 65 66 shouldBe('stream1.active', 'true'); 56 67 shouldBe('stream1.getAudioTracks().length', '1'); 57 68 shouldBe('stream1.getVideoTracks().length', '1'); 58 69 70 shouldBe('stream2.active', 'true'); 59 71 shouldBe('stream2.getAudioTracks().length', '1'); 60 72 shouldBe('stream2.getVideoTracks().length', '1'); … … 62 74 stream1.onaddtrack = shouldNotFire; 63 75 stream1.onremovetrack = shouldNotFire; 76 77 stream2.onactive = shouldFireActive; 78 stream2.oninactive = shouldFireInActive; 64 79 65 80 audioTrack = stream1.getAudioTracks()[0]; … … 120 135 shouldThrow('stream2.addTrack(audioTrack)', '"Error: InvalidStateError: DOM Exception 11"'); 121 136 shouldThrow('stream2.removeTrack(audioTrack)', '"Error: InvalidStateError: DOM Exception 11"'); 122 123 setTimeout(finishJSTest, 0);124 137 } 125 138 -
trunk/Source/WebCore/ChangeLog
r167746 r167750 1 2014-04-23 Praveen R Jadhav <praveen.j@samsung.com> 2 3 [MediaStream] Implement MediaStream active attribute 4 https://bugs.webkit.org/show_bug.cgi?id=131973 5 6 Reviewed by Eric Carlson. 7 8 MediaStream .active attribute are introduced which will replace 9 .ended attribute. This patch implements the newly introduced attributes. 10 11 MediaStream-add-remove-tracks.html is updated to handle this scenario. 12 13 * Modules/mediastream/MediaStream.cpp: 14 (WebCore::MediaStream::active): Added. 15 (WebCore::MediaStream::setActive): Added. 16 (WebCore::MediaStream::addTrack): Propagates 'onactive' event when required. 17 (WebCore::MediaStream::removeTrack): Propagates 'oninactive' event when required. 18 (WebCore::MediaStream::trackDidEnd): Propagates 'oninactive' event when required. 19 (WebCore::MediaStream::streamDidEnd): 20 (WebCore::MediaStream::setStreamIsActive): Added. 21 * Modules/mediastream/MediaStream.h: 22 * Modules/mediastream/MediaStream.idl: 23 * dom/EventNames.h: 24 * platform/mediastream/MediaStreamPrivate.cpp: 25 (WebCore::MediaStreamPrivate::MediaStreamPrivate): Initialize .active attribute 26 (WebCore::MediaStreamPrivate::setEnded): 27 (WebCore::MediaStreamPrivate::setActive): Added. 28 * platform/mediastream/MediaStreamPrivate.h: 29 (WebCore::MediaStreamPrivate::active): Added. 30 1 31 2014-04-23 Darin Adler <darin@apple.com> 2 32 -
trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp
r160181 r167750 127 127 } 128 128 129 bool MediaStream::active() const 130 { 131 return m_private->active(); 132 } 133 134 void MediaStream::setActive(bool isActive) 135 { 136 if (active() == isActive) 137 return; 138 m_private->setActive(isActive); 139 } 140 129 141 PassRefPtr<MediaStream> MediaStream::clone() 130 142 { … … 173 185 track->addObserver(this); 174 186 m_private->addTrack(&track->privateTrack()); 187 setActive(true); 175 188 return true; 176 189 } … … 215 228 216 229 track->removeObserver(this); 217 if (!m_audioTracks.size() && !m_videoTracks.size()) 218 setEnded(); 230 if (!m_audioTracks.size() && !m_videoTracks.size()) { 231 setEnded(); // FIXME : to be removed in bug https://bugs.webkit.org/show_bug.cgi?id=132104 232 setActive(false); 233 } 219 234 220 235 return true; … … 265 280 } 266 281 267 setEnded(); 282 setEnded(); // FIXME : to be removed in bug https://bugs.webkit.org/show_bug.cgi?id=132104 283 284 if (!m_audioTracks.size() && !m_videoTracks.size()) 285 setActive(false); 268 286 } 269 287 … … 274 292 275 293 scheduleDispatchEvent(Event::create(eventNames().endedEvent, false, false)); 294 } 295 296 void MediaStream::setStreamIsActive(bool streamActive) 297 { 298 if (streamActive) 299 scheduleDispatchEvent(Event::create(eventNames().activeEvent, false, false)); 300 else 301 scheduleDispatchEvent(Event::create(eventNames().inactiveEvent, false, false)); 276 302 } 277 303 -
trunk/Source/WebCore/Modules/mediastream/MediaStream.h
r165834 r167750 76 76 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); 77 77 78 bool active() const; 79 void setActive(bool); 80 81 DEFINE_ATTRIBUTE_EVENT_LISTENER(active); 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(inactive); 83 78 84 MediaStreamPrivate* privateStream() const { return m_private.get(); } 79 85 … … 105 111 virtual void trackDidEnd() override final; 106 112 virtual void streamDidEnd() override final; 113 virtual void setStreamIsActive(bool) override final; 107 114 virtual void addRemoteSource(MediaStreamSource*) override final; 108 115 virtual void removeRemoteSource(MediaStreamSource*) override final; -
trunk/Source/WebCore/Modules/mediastream/MediaStream.idl
r159061 r167750 49 49 attribute EventListener onremovetrack; 50 50 51 readonly attribute boolean active; 52 53 attribute EventListener onactive; 54 attribute EventListener oninactive; 55 51 56 // EventTarget interface 52 57 void addEventListener(DOMString type, -
trunk/Source/WebCore/dom/EventNames.h
r163092 r167750 164 164 macro(waiting) \ 165 165 \ 166 macro(active) \ 167 macro(inactive) \ 166 168 macro(addtrack) \ 167 169 macro(cuechange) \ -
trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp
r158849 r167750 130 130 , m_id(id) 131 131 , m_ended(false) 132 , m_isActive(false) 132 133 { 133 134 ASSERT(m_id.length()); … … 141 142 unsigned tracksSize = m_audioPrivateTracks.size() + m_videoPrivateTracks.size(); 142 143 // If sources were provided and no track was added to the MediaStreamPrivate's tracks, this means 143 // that the tracks were all ended 144 // that the tracks were all ended. 145 // Deprecated. to be removed in bug https://bugs.webkit.org/show_bug.cgi?id=132104 144 146 if (providedSourcesSize > 0 && !tracksSize) 145 147 m_ended = true; 148 149 if (providedSourcesSize > 0 && tracksSize > 0) 150 m_isActive = true; 146 151 } 147 152 … … 150 155 , m_id(id) 151 156 , m_ended(false) 157 , m_isActive(false) 152 158 { 153 159 ASSERT(m_id.length()); … … 162 168 // If tracks were provided and no one was added to the MediaStreamPrivate's tracks, this means 163 169 // that the tracks were all ended 170 // Deprecated. to be removed in bug https://bugs.webkit.org/show_bug.cgi?id=132104 164 171 if (providedTracksSize > 0 && !tracksSize) 165 172 m_ended = true; 173 174 if (providedTracksSize > 0 && tracksSize > 0) 175 m_isActive = true; 166 176 } 167 177 … … 172 182 173 183 m_ended = true; 184 } 185 186 void MediaStreamPrivate::setActive(bool active) 187 { 188 if (m_isActive != active) { 189 m_isActive = active; 190 191 if (m_client) 192 m_client->setStreamIsActive(active); 193 } 174 194 } 175 195 -
trunk/Source/WebCore/platform/mediastream/MediaStreamPrivate.h
r158849 r167750 51 51 52 52 virtual void streamDidEnd() = 0; 53 virtual void setStreamIsActive(bool) = 0; 53 54 virtual void addRemoteSource(MediaStreamSource*) = 0; 54 55 virtual void removeRemoteSource(MediaStreamSource*) = 0; … … 87 88 void removeRemoteSource(MediaStreamSource*); 88 89 90 // Deprecated. to be removed in bug https://bugs.webkit.org/show_bug.cgi?id=132104 89 91 bool ended() const { return m_ended; } 90 92 void setEnded(); 93 94 bool active() const { return m_isActive; } 95 void setActive(bool); 91 96 92 97 void addTrack(PassRefPtr<MediaStreamTrackPrivate>); … … 107 112 Vector<RefPtr<MediaStreamTrackPrivate>> m_audioPrivateTracks; 108 113 Vector<RefPtr<MediaStreamTrackPrivate>> m_videoPrivateTracks; 109 bool m_ended; 114 bool m_ended; // Deprecated. to be removed in bug https://bugs.webkit.org/show_bug.cgi?id=132104 115 bool m_isActive; 110 116 }; 111 117
Note:
See TracChangeset
for help on using the changeset viewer.