pipewiresrc: update per-plane stride and offset according to chunk info

This commit is contained in:
Elliot Chen 2026-02-28 14:47:22 +09:00 committed by Wim Taymans
parent 182f52603c
commit 95e89f786a
2 changed files with 12 additions and 1 deletions

View file

@ -412,7 +412,7 @@ gst_deps_def = {
'gio-unix-2.0': {},
'gstreamer-1.0': {'version': '>= 1.10.0'},
'gstreamer-base-1.0': {},
'gstreamer-video-1.0': {},
'gstreamer-video-1.0': {'version': '>= 1.22.0'},
'gstreamer-audio-1.0': {},
'gstreamer-allocators-1.0': {},
}

View file

@ -838,6 +838,17 @@ static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc)
video_size += d->chunk->size;
}
/* If the buffer number is smaller than the plane number,
* update the stride and offset for the remaining planes.
*/
if (n_datas && n_datas < n_planes) {
for (i = n_datas; i < n_planes; i++) {
meta->stride[i] = gst_video_format_info_extrapolate_stride (info->finfo, i, b->buffer->datas[0].chunk->stride);
meta->offset[i] = meta->offset[i-1] +
meta->stride[i-1] * GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (info->finfo, i-1, GST_VIDEO_INFO_HEIGHT(info));
}
}
}
if (b->buffer->n_datas != gst_buffer_n_memory(data->buf)) {