mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
screen-cast/src: Only allocate DMA buffers if other end supports it
The other end of the PipeWire stream can set the buffer data type to a bitmask of supported buffer types. We should respect this, and not attempt to allocate a DMA buffer if it isn't asked for. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1697>
This commit is contained in:
parent
ca95ccdef0
commit
ca22622517
@ -747,10 +747,17 @@ on_stream_add_buffer (void *data,
|
||||
spa_data[0].maxsize = stride * priv->video_format.size.height;
|
||||
spa_data[0].data = NULL;
|
||||
|
||||
dmabuf_handle =
|
||||
meta_screen_cast_create_dma_buf_handle (screen_cast,
|
||||
priv->video_format.size.width,
|
||||
priv->video_format.size.height);
|
||||
if (spa_data[0].type & (1 << SPA_DATA_DmaBuf))
|
||||
{
|
||||
dmabuf_handle =
|
||||
meta_screen_cast_create_dma_buf_handle (screen_cast,
|
||||
priv->video_format.size.width,
|
||||
priv->video_format.size.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
dmabuf_handle = NULL;
|
||||
}
|
||||
|
||||
if (dmabuf_handle)
|
||||
{
|
||||
@ -766,6 +773,13 @@ on_stream_add_buffer (void *data,
|
||||
{
|
||||
unsigned int seals;
|
||||
|
||||
if (!(spa_data[0].type & (1 << SPA_DATA_MemFd)))
|
||||
{
|
||||
g_critical ("No supported PipeWire stream buffer data type could "
|
||||
"be negotiated");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fallback to a memfd buffer */
|
||||
spa_data[0].type = SPA_DATA_MemFd;
|
||||
spa_data[0].flags = SPA_DATA_FLAG_READWRITE;
|
||||
|
Loading…
Reference in New Issue
Block a user