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

Side by Side Diff: third_party/WebKit/Source/modules/mediasource/MediaSource.cpp

Issue 1846863002: Remove SourceBuffer media tracks on detach from media element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-sb-tracks6
Patch Set: Don't attempt to remove anything if there's no tracks Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 ASSERT(isClosed()); 209 ASSERT(isClosed());
210 210
211 m_activeSourceBuffers->clear(); 211 m_activeSourceBuffers->clear();
212 212
213 // Clear SourceBuffer references to this object. 213 // Clear SourceBuffer references to this object.
214 for (unsigned long i = 0; i < m_sourceBuffers->length(); ++i) 214 for (unsigned long i = 0; i < m_sourceBuffers->length(); ++i)
215 m_sourceBuffers->item(i)->removedFromMediaSource(); 215 m_sourceBuffers->item(i)->removedFromMediaSource();
216 m_sourceBuffers->clear(); 216 m_sourceBuffers->clear();
217 217
218 m_attachedElement.clear();
219
218 scheduleEvent(EventTypeNames::sourceclose); 220 scheduleEvent(EventTypeNames::sourceclose);
219 } 221 }
220 222
221 bool MediaSource::isUpdating() const 223 bool MediaSource::isUpdating() const
222 { 224 {
223 // Return true if any member of |m_sourceBuffers| is updating. 225 // Return true if any member of |m_sourceBuffers| is updating.
224 for (unsigned long i = 0; i < m_sourceBuffers->length(); ++i) { 226 for (unsigned long i = 0; i < m_sourceBuffers->length(); ++i) {
225 if (m_sourceBuffers->item(i)->updating()) 227 if (m_sourceBuffers->item(i)->updating())
226 return true; 228 return true;
227 } 229 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 445
444 void MediaSource::setReadyState(const AtomicString& state) 446 void MediaSource::setReadyState(const AtomicString& state)
445 { 447 {
446 ASSERT(state == openKeyword() || state == closedKeyword() || state == endedK eyword()); 448 ASSERT(state == openKeyword() || state == closedKeyword() || state == endedK eyword());
447 449
448 AtomicString oldState = readyState(); 450 AtomicString oldState = readyState();
449 WTF_LOG(Media, "MediaSource::setReadyState() %p : %s -> %s", this, oldState. ascii().data(), state.ascii().data()); 451 WTF_LOG(Media, "MediaSource::setReadyState() %p : %s -> %s", this, oldState. ascii().data(), state.ascii().data());
450 452
451 if (state == closedKeyword()) { 453 if (state == closedKeyword()) {
452 m_webMediaSource.clear(); 454 m_webMediaSource.clear();
453 m_attachedElement.clear();
454 } 455 }
455 456
456 if (oldState == state) 457 if (oldState == state)
457 return; 458 return;
458 459
459 m_readyState = state; 460 m_readyState = state;
460 461
461 onReadyStateChange(oldState, state); 462 onReadyStateChange(oldState, state);
462 } 463 }
463 464
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 615
615 m_asyncEventQueue->enqueueEvent(event); 616 m_asyncEventQueue->enqueueEvent(event);
616 } 617 }
617 618
618 URLRegistry& MediaSource::registry() const 619 URLRegistry& MediaSource::registry() const
619 { 620 {
620 return MediaSourceRegistry::registry(); 621 return MediaSourceRegistry::registry();
621 } 622 }
622 623
623 } // namespace blink 624 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698