From ccc068576a96935dddbf453820beca0d6d5112b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 13 Apr 2016 10:17:24 +0300 Subject: [PATCH] meta: Initialize all GstMeta fields During allocation they are not initialized to all zeroes. https://bugzilla.gnome.org/show_bug.cgi?id=764902 --- gst-libs/gst/codecparsers/gstmpegvideometa.c | 1 + sys/applemedia-nonpublic/coremediabuffer.c | 15 ++++++++++++++- sys/applemedia-nonpublic/corevideobuffer.c | 13 ++++++++++++- sys/applemedia/coremediabuffer.c | 15 ++++++++++++++- sys/applemedia/corevideobuffer.c | 11 +++++++++++ 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/codecparsers/gstmpegvideometa.c b/gst-libs/gst/codecparsers/gstmpegvideometa.c index f7b2f87e75..d5d5f0a102 100644 --- a/gst-libs/gst/codecparsers/gstmpegvideometa.c +++ b/gst-libs/gst/codecparsers/gstmpegvideometa.c @@ -37,6 +37,7 @@ gst_mpeg_video_meta_init (GstMpegVideoMeta * mpeg_video_meta, mpeg_video_meta->pichdr = NULL; mpeg_video_meta->picext = NULL; mpeg_video_meta->quantext = NULL; + mpeg_video_meta->num_slices = mpeg_video_meta->slice_offset = 0; return TRUE; } diff --git a/sys/applemedia-nonpublic/coremediabuffer.c b/sys/applemedia-nonpublic/coremediabuffer.c index a8136ba4ba..bec604ac90 100644 --- a/sys/applemedia-nonpublic/coremediabuffer.c +++ b/sys/applemedia-nonpublic/coremediabuffer.c @@ -19,6 +19,19 @@ #include "coremediabuffer.h" +static gboolean +gst_core_media_meta_init (GstCoreMediaMeta * meta, gpointer params, + GstBuffer * buf) +{ + meta->ctx = NULL; + meta->sample_buf = NULL; + meta->image_buf = NULL; + meta->pixel_buf = NULL; + meta->block_buf = NULL; + + return TRUE; +} + static void gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf) { @@ -52,7 +65,7 @@ gst_core_media_meta_get_info (void) if (g_once_init_enter (&core_media_meta_info)) { const GstMetaInfo *meta = gst_meta_register (GST_CORE_MEDIA_META_API_TYPE, "GstCoreMediaMeta", sizeof (GstCoreMediaMeta), - (GstMetaInitFunction) NULL, + (GstMetaInitFunction) gst_core_media_meta_init, (GstMetaFreeFunction) gst_core_media_meta_free, (GstMetaTransformFunction) NULL); g_once_init_leave (&core_media_meta_info, meta); diff --git a/sys/applemedia-nonpublic/corevideobuffer.c b/sys/applemedia-nonpublic/corevideobuffer.c index 072fe6bd21..26b5643660 100644 --- a/sys/applemedia-nonpublic/corevideobuffer.c +++ b/sys/applemedia-nonpublic/corevideobuffer.c @@ -19,6 +19,17 @@ #include "corevideobuffer.h" +static gboolean +gst_core_video_meta_init (GstCoreVideoMeta * meta, gpointer params, + GstBuffer * buf) +{ + meta->ctx = NULL; + meta->cvbuf = NULL; + meta->pixbuf = NULL; + + return TRUE; +} + static void gst_core_video_meta_free (GstCoreVideoMeta * meta, GstBuffer * buf) { @@ -54,7 +65,7 @@ gst_core_video_meta_get_info (void) if (g_once_init_enter (&core_video_meta_info)) { const GstMetaInfo *meta = gst_meta_register (GST_CORE_VIDEO_META_API_TYPE, "GstCoreVideoMeta", sizeof (GstCoreVideoMeta), - (GstMetaInitFunction) NULL, + (GstMetaInitFunction) gst_core_video_meta_init, (GstMetaFreeFunction) gst_core_video_meta_free, (GstMetaTransformFunction) NULL); g_once_init_leave (&core_video_meta_info, meta); diff --git a/sys/applemedia/coremediabuffer.c b/sys/applemedia/coremediabuffer.c index cf34224d86..4938939adf 100644 --- a/sys/applemedia/coremediabuffer.c +++ b/sys/applemedia/coremediabuffer.c @@ -48,6 +48,19 @@ gst_core_media_meta_add (GstBuffer * buffer, CMSampleBufferRef sample_buf, meta->pixel_buf = NULL; } +static gboolean +gst_core_media_meta_init (GstCoreMediaMeta * meta, gpointer params, + GstBuffer * buf) +{ + meta->ctx = NULL; + meta->sample_buf = NULL; + meta->image_buf = NULL; + meta->pixel_buf = NULL; + meta->block_buf = NULL; + + return TRUE; +} + static void gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf) { @@ -99,7 +112,7 @@ gst_core_media_meta_get_info (void) if (g_once_init_enter (&core_media_meta_info)) { const GstMetaInfo *meta = gst_meta_register (GST_CORE_MEDIA_META_API_TYPE, "GstCoreMediaMeta", sizeof (GstCoreMediaMeta), - (GstMetaInitFunction) NULL, + (GstMetaInitFunction) gst_core_media_meta_init, (GstMetaFreeFunction) gst_core_media_meta_free, (GstMetaTransformFunction) gst_core_media_meta_transform); g_once_init_leave (&core_media_meta_info, meta); diff --git a/sys/applemedia/corevideobuffer.c b/sys/applemedia/corevideobuffer.c index 67d899c1c8..a1530a170d 100644 --- a/sys/applemedia/corevideobuffer.c +++ b/sys/applemedia/corevideobuffer.c @@ -33,6 +33,17 @@ gst_core_video_meta_add (GstBuffer * buffer, CVBufferRef cvbuf) meta->pixbuf = (CVPixelBufferRef) cvbuf; } +static gboolean +gst_core_video_meta_init (GstCoreVideoMeta * meta, gpointer params, + GstBuffer * buf) +{ + meta->ctx = NULL; + meta->cvbuf = NULL; + meta->pixbuf = NULL; + + return TRUE; +} + static void gst_core_video_meta_free (GstCoreVideoMeta * meta, GstBuffer * buf) {