Closed Bug 1999970 Opened 5 months ago Closed 4 months ago

Notify GMP codec impl of skipped encodings

Categories

(Core :: Audio/Video: GMP, task)

task

Tracking

()

RESOLVED FIXED
147 Branch
Tracking Status
firefox-esr140 --- fixed
firefox147 --- fixed

People

(Reporter: pehrsons, Assigned: pehrsons)

References

(Blocks 2 open bugs)

Details

Attachments

(4 files)

See bug 1992567 comment 51 for details. When running the WebRTC GMP OpenH264 encoder at 4k@60 screensharing, it cannot keep up with realtime. It still seems to allocate a buffer to hold the encoded frame, which on skip is immediately dropped -- and to meet bitrate targets, OpenH264 may indeed drop frames. Turning off frame dropping through the API doesn't seem to help.

To avoid what is more or less an unbounded leak, I try to set a hard limit of maximum 1 frame allowed in flight (to the GMP process). When OpenH264 drops a frame however, the WebRTC GMP encoder doesn't learn about this and encoding stalls.

A higher limit (5) seems to work in practice such that we don't have the unbounded leak, but there are no guarantees as we'd again stall the encoding if OpenH264 were to drop 5 frames in a row.

Making the WebRTC GMP encoder synchronous again as per bug 1999747 would also not work, as it also results in an effective limit of 1 frame in flight. Adding a callback to the GMP API for signaling a dropped frame to the client, and implementing this in OpenH264, seems like the best way forward.

Blocks: 1900383

This allows the GMP client (in this case the WebRTC GMP encoder) to know whether
the encoder plugin decided to drop a frame. This lets us avoid flushing the
encoder with more encode jobs than it can handle.

Assignee: nobody → apehrson
Status: NEW → ASSIGNED
Attachment #9526739 - Attachment description: Bug 1999970 - Retrofit a Skipped callback on top of GMP encoder API using input frame destroy calls. r?aosmond → Bug 1999970 - Retrofit a Skipped callback on top of GMP encoder API using input frame destroy calls. r?aosmond!,bwc

The OpenH264 encoder may silently drop a frame due to rate control.
If not handled in the GMP PEM, it may risk stalling waiting for an encoded frame
that never arrives.

Pushed by pehrsons@gmail.com: https://github.com/mozilla-firefox/firefox/commit/9a220092ae14 https://hg.mozilla.org/integration/autoland/rev/9e5dffd97e3a Retrofit a Skipped callback on top of GMP encoder API using input frame destroy calls. r=aosmond,media-playback-reviewers,webrtc-reviewers,bwc https://github.com/mozilla-firefox/firefox/commit/20ccceccb14f https://hg.mozilla.org/integration/autoland/rev/39d124ba4e96 Handle dropped-frame callbacks in the GMP PEM. r=media-playback-reviewers,padenot
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch

This allows the GMP client (in this case the WebRTC GMP encoder) to know whether
the encoder plugin decided to drop a frame. This lets us avoid flushing the
encoder with more encode jobs than it can handle.

Original Revision: https://phabricator.services.mozilla.com/D272613

Attachment #9532689 - Flags: approval-mozilla-esr140?

The OpenH264 encoder may silently drop a frame due to rate control.
If not handled in the GMP PEM, it may risk stalling waiting for an encoded frame
that never arrives.

Original Revision: https://phabricator.services.mozilla.com/D274755

Attachment #9532690 - Flags: approval-mozilla-esr140?
Attachment #9532689 - Flags: approval-mozilla-esr140?
Attachment #9532690 - Flags: approval-mozilla-esr140?
Attachment #9532690 - Flags: approval-mozilla-esr140+
Attachment #9532689 - Flags: approval-mozilla-esr140+
QA Whiteboard: [qa-triage-done-c150/b149]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: