This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21172 - User agents should automatically evict content when the buffer is full if possible
Summary: User agents should automatically evict content when the buffer is full if pos...
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: Media Source Extensions (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Aaron Colwell (c)
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-02 01:29 UTC by Adrian Bateman [MSFT]
Modified: 2013-03-12 22:18 UTC (History)
3 users (show)

See Also:


Attachments

Description Adrian Bateman [MSFT] 2013-03-02 01:29:52 UTC
Problem Description:  Currently, web pages unnecessarily have to deal with SourceBuffer full conditions.  The February 05 editors draft allows implementers to impose limits of their own choosing on buffer depth and then issue a QUOTA_EXCEEDED_ERR on appends if the buffer_full_flag is set to true.  When this happens, the spec states that "the web application must use remove() to free up space in the SourceBuffer" in the Notes.  This unnecessarily imposes buffer maintenance tasks on web clients, which will lead to common developer errors and complicate producing interoperable web applications.  

Some buffer maintenance should be done by the user agent.  This would leave web pages to respond to QUOTA_EXCEEDED_ERR errors only when they have elected to fill future data up to the buffer size limit.  The error then provides meaningful information that the web application must accommodate in its operation.  Purging content from the buffer can and should be automatic whenever possible.
 
Proposed Change: Add a requirement that content should be purged from the SourceBuffer when the buffer full condition is encountered, and throw the QUOTA_EXCEEDED_ERR only when the user agent determines that insufficient data may be purged to prevent the current append from exceeding the buffer capacity. 
 
- Section 4.2: appendArrayBuffer and appendStream:  Modify step 6 from:   
"If the buffer full flag equals true, then throw a QUOTA_EXCEEDED_ERR exception and abort these step.
Note:  The web application must use remove() to free up space in the SourceBuffer.The web application must use remove() to free up space in the SourceBuffer."

To:
"If the buffer full flag equals true, then remove content when possible from the SourceBuffer.  Data must be removed during the Append and prior to Update to avoid conflicts with subsequent append or remove operations.  If not possible, then throw a QUOTA_EXCEEDED_ERR exception and abort these steps.
Note:  The web application should use the QUOTA_EXCEEDED_ERR to manage the depth of buffer appends."
Comment 1 Aaron Colwell (c) 2013-03-04 18:38:39 UTC
Would you mind if I address this by factoring Step 9 of remove() (https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-remove-void-double-start-double-end) into a "coded frame removal algorithm" and then specify the eviction algorithm with something along the following lines.

Coded Frame Eviction Algorithm:
1. Let _new_data_ equal the data that is about to be appended to this SourceBuffer.
2. If the buffer full flag equals false, then abort these steps.
3. Let _removal_ranges_ equal a list of presentation time ranges that can be evicted from the presentation to make room for the _new_data_.
4. For each range in _removal_ranges_, run the _coded_frame_removal_algorithm_ with _start_ and _end_ equal to the range start and end timestamp respectively.
5. If there is enough space in the buffer to accomodate the _new_data_, then set buffer full flag to false.

Then the following step would be added before the _buffer_full_flag_ equals true checks in appendArrayBuffer(), appendStream(), and the stream append loop.

- Run the _coded_frame_eviction_algorithm_.

I think this will make it explicit that eviction will happen before any new data gets appended.
Comment 2 Aaron Colwell (c) 2013-03-12 22:18:50 UTC
Changes committed
https://dvcs.w3.org/hg/html-media/rev/f0fb58d45f96