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

Unified Diff: Source/modules/mediasource/SourceBuffer.cpp

Issue 785343002: Added function to implement Coded Frame Eviction Algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/mediasource/SourceBuffer.h ('k') | public/platform/WebSourceBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/mediasource/SourceBuffer.cpp
diff --git a/Source/modules/mediasource/SourceBuffer.cpp b/Source/modules/mediasource/SourceBuffer.cpp
index e44acdd05d626cece4f1c5cec1854f1354e93d36..066ba8e8d5dc19d8c32cd4d95ad9f42ea7f53616 100644
--- a/Source/modules/mediasource/SourceBuffer.cpp
+++ b/Source/modules/mediasource/SourceBuffer.cpp
@@ -513,7 +513,12 @@ void SourceBuffer::appendBufferInternal(const unsigned char* data, unsigned size
// 3. If the readyState attribute of the parent media source is in the "ended" state then run the following steps: ...
m_source->openIfInEndedState();
- // Steps 4-5 - end "prepare append" algorithm.
+ // 4. Run the coded frame eviction algorithm.
+ if (!evictCodedFrames()) {
+ // 5. If the buffer full flag equals true, then throw a QUOTA_EXCEEDED_ERR exception and abort these steps.
philipj_slow 2014/12/10 09:28:26 I see that we don't have an explicit "buffer full
kjoswiak 2014/12/10 19:11:45 Though other thing I considered doing is adding a
+ exceptionState.throwDOMException(QuotaExceededError, "The SourceBuffer is full, and cannot free space append additional buffers.");
philipj_slow 2014/12/10 09:28:26 missing "to"
kjoswiak 2014/12/10 19:11:45 Done.
+ return;
+ }
// 2. Add data to the end of the input buffer.
ASSERT(data || size == 0);
@@ -611,6 +616,11 @@ void SourceBuffer::removeAsyncPart()
scheduleEvent(EventTypeNames::updateend);
}
+bool SourceBuffer::evictCodedFrames()
+{
+ return m_webSourceBuffer->evictCodedFrames();
+}
+
void SourceBuffer::appendStreamInternal(PassRefPtrWillBeRawPtr<Stream> stream, ExceptionState& exceptionState)
{
// Section 3.2 appendStream()
@@ -634,7 +644,13 @@ void SourceBuffer::appendStreamInternal(PassRefPtrWillBeRawPtr<Stream> stream, E
// 3. If the readyState attribute of the parent media source is in the "ended" state then run the following steps: ...
m_source->openIfInEndedState();
- // Steps 4-5 of the prepare append algorithm are handled by m_webSourceBuffer.
+ // 4. Run the coded frame eviction algorithm.
+ if (!evictCodedFrames()) {
+ // 5. If the buffer full flag equals true, then throw a QUOTA_EXCEEDED_ERR exception and abort these steps.
+ // TODO(kjoswiak): Is this accurate? Are we actually appending data, or appending a data source?
philipj_slow 2014/12/10 09:28:26 No TODO(user) in Blink, just FIXME. Even better, i
kjoswiak 2014/12/10 19:11:45 whoops meant to remove this, I had actually come t
+ exceptionState.throwDOMException(QuotaExceededError, "The SourceBuffer is full, and cannot free space to append stream.");
+ return;
+ }
// 2. Set the updating attribute to true.
m_updating = true;
« no previous file with comments | « Source/modules/mediasource/SourceBuffer.h ('k') | public/platform/WebSourceBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698