[Bug 751605] audio: Add proper support for non-interleaved / planar audio

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Sun May 6 09:24:05 UTC 2018


https://bugzilla.gnome.org/show_bug.cgi?id=751605

Sebastian Dröge (slomo) <slomo at coaxion.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #371726|none                        |reviewed
             status|                            |

--- Comment #19 from Sebastian Dröge (slomo) <slomo at coaxion.net> ---
Review of attachment 371726:
 --> (https://bugzilla.gnome.org/review?bug=751605&attachment=371726)

::: gst-libs/gst/audio/audio-buffer.c
@@ +60,3 @@
+  buffer->map_info = buffer->priv_map_info_arr;
+
+  if (!gst_buffer_map (gstbuffer, &buffer->map_info[0], flags))

For the mapping, maybe take a look at the video frame mapping function. It
would be nice to only have to copy together memories when mapping and a single
channel is in multiple memories. And to only do a single mapping at most per
memory.

::: gst-libs/gst/audio/audio-buffer.h
@@ +52,3 @@
+  gpointer    *planes;
+
+  GstBuffer   *gstbuffer;

Why the gst prefix?

@@ +62,3 @@
+
+  gpointer _gst_reserved[GST_PADDING];
+} GstAudioBuffer;

Should some macros be added here already? For getting the audio info, getting
the data of the n-th channel, accessors for the audio info fields too maybe?

::: gst-libs/gst/audio/gstaudiometa.c
@@ +314,3 @@
+  gst_audio_info_init (&ameta->info);
+  ameta->samples = 0;
+  ameta->offsets = NULL;

You need to initialize all the fields, otherwise they'll contain garbage

@@ +402,3 @@
+      /* default offsets assume channels are laid out sequentially in memory
*/
+      for (i = 0; i < info->channels; i++)
+        meta->offsets[i] = i * samples * info->finfo->width / 8;

GST_AUDIO_INFO_BPS :)

::: gst-libs/gst/audio/gstaudiometa.h
@@ +156,3 @@
+ * Since: 1.16
+ */
+struct _GstAudioMeta {

Should it maybe be get the word "planar" in here, or do you expect this to be
also useful for interleaved audio somehow?

@@ +161,3 @@
+  GstAudioInfo   info;
+  gsize          samples;
+  gsize          *offsets;

Is it allowed to have multiple channels with the same offset, to cheaply
duplicate a channel?

@@ +180,3 @@
+GstAudioMeta * gst_buffer_add_audio_meta (GstBuffer *buffer,
+                                          const GstAudioInfo *info,
+                                          gsize samples, gsize offsets[]);

This should maybe sanity-check the buffer size against the number of samples?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list