Skip to content

cefsrc: Repeat the last frame in live mode when the page does not repaint - #114

Closed
hevc wants to merge 1 commit into
centricular:masterfrom
hevc:repeat-last-frame
Closed

hevc wants to merge 1 commit into
centricular:masterfrom
hevc:repeat-last-frame

Conversation

@hevc

@hevc hevc commented Nov 3, 2026

Copy link
Copy Markdown

Since frames come from CEF timestamps and an internal queue, create() only returns a video buffer when OnPaint() queued one, and CEF calls OnPaint() only when the page changes. A static page (an empty video call, every camera turned off, a slide) therefore stops the video stream entirely while the element still reports itself as a live source, and downstream sees the source as stalled: a fallbackswitch switches to its fallback, encoders and segmenters starve.

In live mode, wait at most one frame at max-video-framerate for the next paint and push a copy of the last frame, stamped with the current running time like a painted one, if none came. The wait is measured from the last video buffer pushed rather than from entering create(), because audio wakes create() far more often than once per frame. The last frame is dropped on stop and on a caps change so it is never repeated at a stale size.

…aint

Since frames come from CEF timestamps and an internal queue, create() only
returns a video buffer when OnPaint() queued one, and CEF calls OnPaint()
only when the page changes. A static page (an empty video call, every
camera turned off, a slide) therefore stops the video stream entirely while
the element still reports itself as a live source, and downstream sees the
source as stalled: a fallbackswitch switches to its fallback, encoders and
segmenters starve.

In live mode, wait at most one frame at max-video-framerate for the next
paint and push a copy of the last frame, stamped with the current running
time like a painted one, if none came. The wait is measured from the last
video buffer pushed rather than from entering create(), because audio wakes
create() far more often than once per frame. The last frame is dropped on
stop and on a caps change so it is never repeated at a stale size.
@MathieuDuponchelle

Copy link
Copy Markdown
Collaborator

@hevc this new behavior was introduced recently, the element explicitly advertises a variable framerate now so it is not breaking its own contract when not pushing frames for an extended period of time :)

See related discussion here: https://github.com/centricular/gstcefsrc/pull/107/changes#r2865174607 , you should be able to obtain the desired behavior by using a livesync element downstream :)

@hevc

hevc commented Nov 5, 2026

Copy link
Copy Markdown
Author

I see. I used the livesync plugin.

@hevc hevc closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants