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

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

Issue 1013923002: Fix MSE GC, make it less aggressive, more spec-compliant (Blink CL) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: m_loader might be released before didFail, if appendStream failed due to full buffer Created 5 years, 4 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
« no previous file with comments | « Source/modules/mediasource/MediaSource.h ('k') | Source/modules/mediasource/SourceBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps. 149 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps.
150 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps 150 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps
151 return 0; 151 return 0;
152 } 152 }
153 153
154 SourceBuffer* buffer = SourceBuffer::create(webSourceBuffer.release(), this, m_asyncEventQueue.get()); 154 SourceBuffer* buffer = SourceBuffer::create(webSourceBuffer.release(), this, m_asyncEventQueue.get());
155 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object. 155 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object.
156 m_sourceBuffers->add(buffer); 156 m_sourceBuffers->add(buffer);
157 157
158 // 7. Return the new object to the caller. 158 // 7. Return the new object to the caller.
159 WTF_LOG(Media, "MediaSource::addSourceBuffer(%s) %p -> %p", type.ascii().dat a(), this, buffer);
159 return buffer; 160 return buffer;
160 } 161 }
161 162
162 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& excep tionState) 163 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& excep tionState)
163 { 164 {
164 WTF_LOG(Media, "MediaSource::removeSourceBuffer() %p", this); 165 WTF_LOG(Media, "MediaSource::removeSourceBuffer() %p", this);
165 166
166 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media -source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer 167 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media -source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer
167 168
168 // 1. If sourceBuffer specifies an object that is not in sourceBuffers then 169 // 1. If sourceBuffer specifies an object that is not in sourceBuffers then
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 509
509 size_t insertPosition = 0; 510 size_t insertPosition = 0;
510 while (insertPosition < m_activeSourceBuffers->length() 511 while (insertPosition < m_activeSourceBuffers->length()
511 && m_sourceBuffers->find(m_activeSourceBuffers->item(insertPosition)) < indexInSourceBuffers) { 512 && m_sourceBuffers->find(m_activeSourceBuffers->item(insertPosition)) < indexInSourceBuffers) {
512 ++insertPosition; 513 ++insertPosition;
513 } 514 }
514 515
515 m_activeSourceBuffers->insert(insertPosition, sourceBuffer); 516 m_activeSourceBuffers->insert(insertPosition, sourceBuffer);
516 } 517 }
517 518
519 HTMLMediaElement* MediaSource::mediaElement() const
520 {
521 return m_attachedElement.get();
522 }
523
518 bool MediaSource::isClosed() const 524 bool MediaSource::isClosed() const
519 { 525 {
520 return readyState() == closedKeyword(); 526 return readyState() == closedKeyword();
521 } 527 }
522 528
523 void MediaSource::close() 529 void MediaSource::close()
524 { 530 {
525 setReadyState(closedKeyword()); 531 setReadyState(closedKeyword());
526 } 532 }
527 533
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 604
599 m_asyncEventQueue->enqueueEvent(event.release()); 605 m_asyncEventQueue->enqueueEvent(event.release());
600 } 606 }
601 607
602 URLRegistry& MediaSource::registry() const 608 URLRegistry& MediaSource::registry() const
603 { 609 {
604 return MediaSourceRegistry::registry(); 610 return MediaSourceRegistry::registry();
605 } 611 }
606 612
607 } // namespace blink 613 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/mediasource/MediaSource.h ('k') | Source/modules/mediasource/SourceBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698