mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
video-frame: Mapping a frame with inconsistent values between GstVideoMeta and GstVideoInfo is a bug
It will cause the frame to be initialized with inconsistent values that then later can cause crashes or any other kind of interesting and hard to debug bugs.
This commit is contained in:
parent
1ec4d764fc
commit
afcc0b3c50
1 changed files with 7 additions and 1 deletions
|
@ -72,13 +72,19 @@ gst_video_frame_map_id (GstVideoFrame * frame, GstVideoInfo * info,
|
|||
frame->info = *info;
|
||||
|
||||
if (meta) {
|
||||
/* All these values must be consistent */
|
||||
g_return_val_if_fail (info->finfo->format == meta->format, FALSE);
|
||||
g_return_val_if_fail (info->width == meta->width, FALSE);
|
||||
g_return_val_if_fail (info->height == meta->height, FALSE);
|
||||
g_return_val_if_fail (info->finfo->n_planes == meta->n_planes, FALSE);
|
||||
|
||||
frame->info.finfo = gst_video_format_get_info (meta->format);
|
||||
frame->info.width = meta->width;
|
||||
frame->info.height = meta->height;
|
||||
frame->id = meta->id;
|
||||
frame->flags = meta->flags;
|
||||
|
||||
for (i = 0; i < info->finfo->n_planes; i++) {
|
||||
for (i = 0; i < meta->n_planes; i++) {
|
||||
frame->info.offset[i] = meta->offset[i];
|
||||
if (!gst_video_meta_map (meta, i, &frame->map[i], &frame->data[i],
|
||||
&frame->info.stride[i], flags))
|
||||
|
|
Loading…
Reference in a new issue