OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011, 2012 Ericsson AB. 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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 MediaStream::~MediaStream() | 151 MediaStream::~MediaStream() |
152 { | 152 { |
153 m_descriptor->setClient(0); | 153 m_descriptor->setClient(0); |
154 } | 154 } |
155 | 155 |
156 bool MediaStream::ended() const | 156 bool MediaStream::ended() const |
157 { | 157 { |
158 return m_stopped || m_descriptor->ended(); | 158 return m_stopped || m_descriptor->ended(); |
159 } | 159 } |
160 | 160 |
| 161 MediaStreamTrackVector MediaStream::getTracks() |
| 162 { |
| 163 MediaStreamTrackVector tracks; |
| 164 for (MediaStreamTrackVector::iterator iter = m_audioTracks.begin(); iter !=
m_audioTracks.end(); ++iter) |
| 165 tracks.append(iter->get()); |
| 166 for (MediaStreamTrackVector::iterator iter = m_videoTracks.begin(); iter !=
m_videoTracks.end(); ++iter) |
| 167 tracks.append(iter->get()); |
| 168 return tracks; |
| 169 } |
| 170 |
161 void MediaStream::addTrack(MediaStreamTrack* track, ExceptionState& exceptionSta
te) | 171 void MediaStream::addTrack(MediaStreamTrack* track, ExceptionState& exceptionSta
te) |
162 { | 172 { |
163 if (ended()) { | 173 if (ended()) { |
164 exceptionState.throwDOMException(InvalidStateError, "The MediaStream is
finished."); | 174 exceptionState.throwDOMException(InvalidStateError, "The MediaStream is
finished."); |
165 return; | 175 return; |
166 } | 176 } |
167 | 177 |
168 if (!track) { | 178 if (!track) { |
169 exceptionState.throwDOMException(TypeMismatchError, "The MediaStreamTrac
k provided is invalid."); | 179 exceptionState.throwDOMException(TypeMismatchError, "The MediaStreamTrac
k provided is invalid."); |
170 return; | 180 return; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 392 |
383 void MediaStream::trace(Visitor* visitor) | 393 void MediaStream::trace(Visitor* visitor) |
384 { | 394 { |
385 visitor->trace(m_audioTracks); | 395 visitor->trace(m_audioTracks); |
386 visitor->trace(m_videoTracks); | 396 visitor->trace(m_videoTracks); |
387 visitor->trace(m_scheduledEvents); | 397 visitor->trace(m_scheduledEvents); |
388 EventTargetWithInlineData::trace(visitor); | 398 EventTargetWithInlineData::trace(visitor); |
389 } | 399 } |
390 | 400 |
391 } // namespace WebCore | 401 } // namespace WebCore |
OLD | NEW |