screen-cast/stream-src: Calculate stride after adding handle to hash table

`calculate_stride()` looks up the dmabuf handle from the hash table so
we need to add it first.

Fixes 9b663f44e6

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3326>
This commit is contained in:
Robert Mader 2023-10-13 15:37:27 +02:00 committed by Marge Bot
parent ed6c335140
commit 5809ef62f5

View File

@ -1134,12 +1134,12 @@ on_stream_add_buffer (void *data,
spa_data->flags = SPA_DATA_FLAG_READWRITE; spa_data->flags = SPA_DATA_FLAG_READWRITE;
spa_data->fd = cogl_dma_buf_handle_get_fd (dmabuf_handle); spa_data->fd = cogl_dma_buf_handle_get_fd (dmabuf_handle);
stride = meta_screen_cast_stream_src_calculate_stride (src, spa_data);
spa_data->maxsize = stride * priv->video_format.size.height;
g_hash_table_insert (priv->dmabuf_handles, g_hash_table_insert (priv->dmabuf_handles,
GINT_TO_POINTER (spa_data->fd), GINT_TO_POINTER (spa_data->fd),
dmabuf_handle); dmabuf_handle);
stride = meta_screen_cast_stream_src_calculate_stride (src, spa_data);
spa_data->maxsize = stride * priv->video_format.size.height;
} }
else else
{ {