gst: handle blocking in the _render() function

When we do any other blocking in the render function, we should unblock
and call _wait_preroll() when we go to PAUSED.

We can have this situation when all the buffers are queued in the
pw_stream and we get a new _render() call. We can't get more buffers
from the pool and so we must block and wait.  When we go to PAUSED we
need to unlock and go to _wait_preroll(). Implement this by setting a
pool paused flag that is set when the sink goes to paused, we can then
return a special value that does the wait_preroll().

See !2248
This commit is contained in:
Wim Taymans 2025-01-17 16:33:15 +01:00
parent 85c5d65c97
commit c7ccc5abca
3 changed files with 34 additions and 3 deletions

View file

@ -44,6 +44,7 @@ struct _GstPipeWirePool {
GstAllocator *dmabuf_allocator;
GCond cond;
gboolean paused;
};
GstPipeWirePool * gst_pipewire_pool_new (GstPipeWireStream *stream);
@ -59,6 +60,8 @@ gst_pipewire_pool_has_buffers (GstPipeWirePool *pool)
GstPipeWirePoolData *gst_pipewire_pool_get_data (GstBuffer *buffer);
void gst_pipewire_pool_set_paused (GstPipeWirePool *pool, gboolean paused);
G_END_DECLS
#endif /* __GST_PIPEWIRE_POOL_H__ */