gstreamer/gst-libs/gst/audio
mrk501 361835979e audioringbuffer: Fix wrong memcpy address when reordering channels
When using multichannel audio data and being needed to reorder channels,
audio data is not copied correctly because destination address of
memcpy is wrong.

For example, the following command
$ gst-launch-1.0 pulsesrc ! audio/x-raw,channels=6,format=S16LE ! filesink location=test.raw
will reproduce this issue if there is 6-ch audio input device.

This commit fixes that.

The detailed process of this issue is as follows:
1. gst-launch-1.0 calls gst_pulsesrc_prepare (gst-plugins-good/ext/pulse/pulsesrc.c)

   1466 gst_pulsesrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
   1467 {
   (skip...)
   1480   {
   1481     GstAudioRingBufferSpec s = *spec;
   1482     const pa_channel_map *m;
   1483
   1484     m = pa_stream_get_channel_map (pulsesrc->stream);
   1485     gst_pulse_channel_map_to_gst (m, &s);
   1486     gst_audio_ring_buffer_set_channel_positions (GST_AUDIO_BASE_SRC
   1487         (pulsesrc)->ringbuffer, s.info.position);
   1488   }

   In my environment, after line 1485 is processed, position of spec and s are
     spec->info.position[0] = 0
     spec->info.position[1] = 1
     spec->info.position[2] = 2
     spec->info.position[3] = 6
     spec->info.position[4] = 7
     spec->info.position[5] = 8

     s.info.position[0] = 0
     s.info.position[1] = 6
     s.info.position[2] = 2
     s.info.position[3] = 1
     s.info.position[4] = 7
     s.info.position[5] = 8

   The values of spec->info.positions equal
   GST_AUDIO_BASE_SRC(pulsesrc)->ringbuffer->spec->info.positions.

2. gst_audio_ring_buffer_set_channel_positions calls
   gst_audio_get_channel_reorder_map.

3. Arguments of gst_audio_get_channel_reorder_map are
    from = s.info.position
    to = GST_AUDIO_BASE_SRC(pulsesrc)->ringbuffer->spec->info.positions

   At the end of this function, reorder_map is set to
     reorder_map[0] = 0
     reorder_map[1] = 3
     reorder_map[2] = 2
     reorder_map[3] = 1
     reorder_map[4] = 4
     reorder_map[5] = 5

4. Go back to gst_audio_ring_buffer_set_channel_positions and
   2065       buf->need_reorder = TRUE;
   is processed.

5. Finally, in gst_audio_ring_buffer_read,

   1821     if (need_reorder) {
   (skip...)
   1829           memcpy (data + i * bpf + reorder_map[j] * bps, ptr + j * bps, bps);

   is processed and makes this issue.
2019-01-29 14:49:19 +00:00
..
.gitignore Update .gitignore 2012-08-08 09:06:30 +01:00
audio-buffer.c audio-buffer: fix typo in assignment that causes buggy behavior 2018-07-24 15:09:25 +03:00
audio-buffer.h libs: audio: Implement GstAudioBuffer & GstAudioMeta 2018-07-03 14:06:43 +03:00
audio-channel-mixer.c libs: audio-channel-mixer: add support for non-interleaved audio buffers 2018-07-11 16:26:13 +03:00
audio-channel-mixer.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
audio-channels.c libs: audio: implement planar buffer support in gst_audio_buffer_reorder_channels() 2018-07-12 13:38:27 +03:00
audio-channels.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
audio-converter.c audio-converter: add API to determine passthrough mode 2018-12-17 14:23:49 +00:00
audio-converter.h audio-converter: add API to determine passthrough mode 2018-12-17 14:23:49 +00:00
audio-format.c audio: const gpointer is not the same as gconstpointer/const void * 2018-11-05 08:16:16 +00:00
audio-format.h audio: const gpointer is not the same as gconstpointer/const void * 2018-11-05 08:16:16 +00:00
audio-info.c audio: fix some GIR annotations 2018-04-23 19:33:19 +02:00
audio-info.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
audio-prelude.h libs: fix API export/import and 'inconsistent linkage' on MSVC 2018-09-24 08:45:34 +01:00
audio-quantize.c gst-libs: include config.h in all source files 2018-08-13 09:23:34 +01:00
audio-quantize.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
audio-resampler-macros.h audioresample: Separate out CFLAGS used for SSE* code 2016-09-29 18:37:08 +05:30
audio-resampler-neon.h audioresample: Separate out CFLAGS used for SSE* code 2016-09-29 18:37:08 +05:30
audio-resampler-private.h audioresample: Separate out CFLAGS used for SSE* code 2016-09-29 18:37:08 +05:30
audio-resampler-x86-sse.c audioresample: Separate out CFLAGS used for SSE* code 2016-09-29 18:37:08 +05:30
audio-resampler-x86-sse.h audioresample: Separate out CFLAGS used for SSE* code 2016-09-29 18:37:08 +05:30
audio-resampler-x86-sse2.c audioresample: Separate out CFLAGS used for SSE* code 2016-09-29 18:37:08 +05:30
audio-resampler-x86-sse2.h audioresample: Separate out CFLAGS used for SSE* code 2016-09-29 18:37:08 +05:30
audio-resampler-x86-sse41.c audio-resampler: Fix integer overflow in clamping code 2017-01-30 12:35:04 +02:00
audio-resampler-x86-sse41.h audioresample: Separate out CFLAGS used for SSE* code 2016-09-29 18:37:08 +05:30
audio-resampler-x86.h audiorsample: Fix build on 32-bit x86 2016-09-29 19:45:16 +05:30
audio-resampler.c libs: audio-resampler: add support for consuming non-interleaved input buffers 2018-07-11 16:26:13 +03:00
audio-resampler.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
audio.c libs: audio: add a new gst_audio_buffer_truncate() function 2018-07-12 12:08:10 +03:00
audio.h audio: use right export decorator 2018-08-26 11:16:10 +02:00
dbesi0.c audio-converter: add resampler 2016-03-28 13:13:59 +02:00
gstaudioaggregator.c audioaggregator: Also run the audio-specific caps fixation for audio aggregator subclasses that can't convert 2018-08-16 18:03:37 +03:00
gstaudioaggregator.h libs: Documentation cleanup 2018-04-02 08:53:28 +02:00
gstaudiobasesink.c audiobasesink: Remove dead assignment 2018-12-17 12:21:01 +01:00
gstaudiobasesink.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudiobasesrc.c audiobasesrc: Round down segsize to an integer number of samples 2018-06-29 07:38:20 +02:00
gstaudiobasesrc.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudiocdsrc.c audio: Update for g_type_class_add_private() deprecation in recent GLib 2018-06-23 21:49:48 +02:00
gstaudiocdsrc.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudioclock.c audioclock: Sink the reference in the constructor 2017-05-17 10:40:52 +03:00
gstaudioclock.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudiodecoder.c Run gst-indent through the files 2018-11-28 05:51:53 +02:00
gstaudiodecoder.h audiodecoder: add API for setting caps on the source pad 2018-11-21 10:11:40 +00:00
gstaudioencoder.c audio: Update for g_type_class_add_private() deprecation in recent GLib 2018-06-23 21:49:48 +02:00
gstaudioencoder.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudiofilter.c docs: Convert gtkdoc comments to markdown 2017-03-10 18:19:17 -03:00
gstaudiofilter.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudioiec61937.c docs: Convert gtkdoc comments to markdown 2017-03-10 18:19:17 -03:00
gstaudioiec61937.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudiometa.c gst-libs: include config.h in all source files 2018-08-13 09:23:34 +01:00
gstaudiometa.h audiometa: fix docs typo 2019-01-06 00:48:56 +00:00
gstaudiopack-dist.c Update disted backup ORC files 2018-02-15 07:14:20 +01:00
gstaudiopack-dist.h audio: update ORC dist files 2015-11-06 17:54:21 +01:00
gstaudiopack.orc gstaudiopack.orc: pack_u32be_swap: actually swap 2018-02-15 01:32:54 +01:00
gstaudioringbuffer.c audioringbuffer: Fix wrong memcpy address when reordering channels 2019-01-29 14:49:19 +00:00
gstaudioringbuffer.h libs: Documentation cleanup 2018-04-02 08:53:28 +02:00
gstaudiosink.c gstaudiosrc/sink: Set audio ringbuffer thread priority 2018-09-11 00:41:59 +05:30
gstaudiosink.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudiosrc.c gstaudiosrc/sink: Set audio ringbuffer thread priority 2018-09-11 00:41:59 +05:30
gstaudiosrc.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
gstaudiostreamalign.c libs: Documentation cleanup 2018-04-02 08:53:28 +02:00
gstaudiostreamalign.h audiostreamalign: Mark the whole type as new in 1.14 2018-03-15 09:58:11 +02:00
gstaudioutilsprivate.c gstaudioutilsprivate: Fix warnings while setting thread priority 2018-09-24 19:44:28 +05:30
gstaudioutilsprivate.h gstaudioutilsprivate: Fix warnings while setting thread priority 2018-09-24 19:44:28 +05:30
Makefile.am libs: fix API export/import and 'inconsistent linkage' on MSVC 2018-09-24 08:45:34 +01:00
meson.build meson: Replace empty configuration_data() with copy keyword 2018-10-17 13:48:47 +01:00
streamvolume.c docs: Convert gtkdoc comments to markdown 2017-03-10 18:19:17 -03:00
streamvolume.h audio: GST_EXPORT -> GST_AUDIO_API 2018-03-13 10:36:56 +00:00
TODO gst-libs/gst/audio/TODO: Update TODO 2006-02-17 10:15:52 +00:00