Avoid UpdateReadyState event queue traffic when the next frame status has not changed

RESOLVED FIXED in mozilla20

Status

()

defect
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: kinetik, Assigned: kinetik)

Tracking

Trunk
mozilla20
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
While in the debugger I noticed a large number of calls to nsHTMLMediaElement::ChangeReadyState via UpdateReadyStateForData hitting the early-exit path because the ready state was not changing.  MediaDecoderStateMachine::UpdateReadyState is called from multiple places and dispatches an event each time, even if the state is unchanged.  This can result in many events being created and dispatched during a single video frame.

With a simple current == last status early-exit path added to MediaDecoderStateMachine::UpdateReadyState, the number of events created and dispatched for a simple play-through of a 5 minute video drops from ~140,000 (~468/s or ~15/frame) to 3.
(Assignee)

Comment 1

6 years ago
Posted patch patch v0Splinter Review
Tests pass locally.  Try push: https://tbpl.mozilla.org/?tree=Try&rev=9c79c64b62d2
Attachment #693745 - Flags: review?(roc)
Comment on attachment 693745 [details] [diff] [review]
patch v0

Review of attachment 693745 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch
Attachment #693745 - Flags: review?(roc) → review+
(Assignee)

Updated

6 years ago
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/5f697a87ec46
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20

Updated

6 years ago
Blocks: 823168
(Assignee)

Updated

6 years ago
Blocks: 495040
You need to log in before you can comment on or make changes to this bug.