mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
gst: correct buffer & meta offset calculation
The offset in GstVideoMeta point to location of merge-mapped buffer memories (see "gst_buffer_find_memory()") instead of raw memory location for each plane, make adjustment to comply this rule.
Also some cleanups.
Fixes 023577e391
This commit is contained in:
parent
4f9f32084c
commit
4b60569c4a
2 changed files with 11 additions and 5 deletions
|
|
@ -508,13 +508,16 @@ do_send_buffer (GstPipeWireSink *pwsink, GstBuffer *buffer)
|
|||
GstVideoMeta *meta = gst_buffer_get_video_meta (buffer);
|
||||
if (meta) {
|
||||
if (meta->n_planes == b->n_datas) {
|
||||
gsize video_size = 0;
|
||||
for (i = 0; i < meta->n_planes; i++) {
|
||||
struct spa_data *d = &b->datas[i];
|
||||
d->chunk->offset = meta->offset[i];
|
||||
d->chunk->offset += meta->offset[i] - video_size;
|
||||
d->chunk->stride = meta->stride[i];
|
||||
|
||||
video_size += d->chunk->size;
|
||||
}
|
||||
} else {
|
||||
GST_ERROR ("plane num not matching, meta:%d buffer:%d", meta->n_planes, b->n_datas);
|
||||
GST_ERROR ("plane num not matching, meta:%u buffer:%u", meta->n_planes, b->n_datas);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue