GNOME Bugzilla – Bug 752442
gtksink: Display once black frame when caps changes
Last modified: 2015-08-16 13:40:05 UTC
Both gtksink and gtkglsink displays a black frame when caps changes. The problem is that set_caps() is not asynchonous as it should. It drops the pending frame, without cancelling the redraw. That leads to a black frame being shown. This drop of frame is systematic since set caps is called immediately after the last show frame. I suggest to fix bug 752441 first, as this would lead to yet more copy paste.
We could make the widget_set_buffer() be widget_set_sample() instead and provide the caps in band with the buffer instead as a GstSample.
But that would require parsing caps every frame. Probably better just to track it in the sink and only widget_set_caps() on different caps in sink_show_frame(). The _queue_resize() should also disappear from sink_get_caps() as that will also perform a redraw.
> But that would require parsing caps every frame. Would it? Should just be a pointer comparison in the nothing-has-changed case, no?
It does not have to be that complex. I'll pass the format information through the resize idle (not sure if we should give that a better name) and only do the reset() and v_info update there. This way it will be done after any pending draw message. This should prevent systematically loosing a frame. Remains to handle the case where resize we have draw, resize already queued while the next frame arrive (the case where the resize took too long). We'll need a condition to detect that, in that case, I'm remove the the draw idle and queue it again, so it is places after in the queue.
Actually that is still racy, but I'll work on that. I already have a pseudo base class for the widget, so I won't have to do it twice.
I've attached the patches to the wrong bug, sorry. Attachment 307638 [details] pushed as d0fd6a0 - gtkgstbasewidget: Pass already parsed VideoInfo Attachment 307639 [details] pushed as 410ffd5 - gtkgstbasewidget: Fix black frame on resize Attachment 307640 [details] pushed as 5e87b9f - gtkglsink: Don't leak vertex array and buffers