Evicting data can leave data in unplayable state, leading to stalls.

RESOLVED FIXED in Firefox 39

Status

()

Core
Audio/Video
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: jya, Assigned: jya)

Tracking

Trunk
mozilla39
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(firefox39 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
This is a similar problem as in bug 1132825.

When evicting data, we calculate the position within the stream of the preceding moof (mp4) or cluster (webm); we then evict data up to that offset.

However, the SourceBufferResource uses a ResourceQueue made of ResourceItems each matching the block of data fed to SourceBuffer::AppendData; no partial block can ever be removed.

YouTube often feeds partial media segments, where the beginning of a media segment would be a partial mdat followed by a MOOF within the data.
Should we attempt to evict from this MOOF, we would actually truncate the data at the beginning of the ResourceItem and as such, on the partial mdat.

The MP4 parser is unable to parse this data as it is now corrupted. The buffered range for this source buffer is now empty.

There's the same issue with WebM (actually it appears to happen more often than with MP4)

When truncating data, we should never evict data so that the remaining data is unusable. (e.g for MP4 always truncate on a moof or cluster boundary)
(Assignee)

Comment 1

3 years ago
There are two ways we can solve this problem.

Store an offset value within the ResourceItem ; or create a new ResourceItem.mData that has been truncated.

The later is much easier to implement, the trouble is if code using ResourceItem only hold a weak reference: it could result in data being deleted while using it.
Flags: needinfo?(cajbir.bugzilla)

Comment 2

3 years ago
As discussed on whiteboard, "create a new ResourceItem.mData that has been truncated" seems the better approach.
Flags: needinfo?(cajbir.bugzilla)
(Assignee)

Comment 3

3 years ago
Created attachment 8568253 [details] [diff] [review]
Allow partial truncation from ResourceQueue

Handle partial ResourceItem eviction so we never truncate other than on a moof
Attachment #8568253 - Flags: review?(cajbir.bugzilla)
(Assignee)

Updated

3 years ago
Assignee: nobody → jyavenard
Status: NEW → ASSIGNED

Updated

3 years ago
Attachment #8568253 - Flags: review?(cajbir.bugzilla) → review+
(Assignee)

Comment 4

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/7dcf7b36267a
Blocks: 1136138
https://hg.mozilla.org/mozilla-central/rev/7dcf7b36267a
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox39: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.