level: Level meta insertion might require buffer copy
It's a corner issue but placing a level
downstream of a tee
triggers critical warnings:
$ G_DEBUG=fatal_criticals gdb -args gst-launch-1.0 audiotestsrc num-buffers=1 ! tee name=t ! queue ! level audio-level-meta=1 ! fakesink t. ! queue ! fakesink
...
(gdb) r
...
(gst-launch-1.0:409684): GStreamer-CRITICAL **: 13:15:32.654: gst_buffer_add_meta: assertion 'gst_buffer_is_writable (buffer)' failed
Thread 3 "queue0:src" received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 0x7fffe8e71640 (LWP 409689)]
0x00007ffff7d8f7e3 in g_logv () from /lib64/libglib-2.0.so.0
(gdb) bt
#0 0x00007ffff7d8f7e3 in g_logv () at /lib64/libglib-2.0.so.0
#1 0x00007ffff7d8fa53 in g_log () at /lib64/libglib-2.0.so.0
#2 0x00007ffff7ecb56b in gst_buffer_add_meta (buffer=buffer@entry=0x6d95a0, info=0x7fffdc0025e0, params=params@entry=0x0) at ../subprojects/gstreamer/gst/gstbuffer.c:2279
#3 0x00007fffe98cd5c9 in gst_buffer_add_audio_level_meta (buffer=buffer@entry=0x6d95a0, level=4 '\004', voice_activity=voice_activity@entry=0)
at ../subprojects/gst-plugins-base/gst-libs/gst/audio/gstaudiometa.c:595
#4 0x00007fffe967695b in gst_level_rtp_audio_level_meta (self=<optimized out>, buffer=0x6d95a0, level=4 '\004') at ../subprojects/gst-plugins-good/gst/level/gstlevel.c:582
#5 gst_level_transform_ip (trans=<optimized out>, in=<optimized out>) at ../subprojects/gst-plugins-good/gst/level/gstlevel.c:711
#6 0x00007fffe983da7e in default_generate_output (trans=0x6ba130, outbuf=0x7fffe8e70b60) at ../subprojects/gstreamer/libs/gst/base/gstbasetransform.c:2182
#7 0x00007fffe9842f36 in gst_base_transform_chain (pad=<optimized out>, pad@entry=0x6b2a90, parent=parent@entry=0x6ba130, buffer=<optimized out>, buffer@entry=0x6d95a0)
at ../subprojects/gstreamer/libs/gst/base/gstbasetransform.c:2341
#8 0x00007ffff7f0c03f in gst_pad_chain_data_unchecked (pad=pad@entry=0x6b2a90, type=<optimized out>, type@entry=4112, data=<optimized out>, data@entry=0x6d95a0) at ../subprojects/gstreamer/gst/gstpad.c:4442
#9 0x00007ffff7f0ce22 in gst_pad_push_data (pad=pad@entry=0x6b2840, type=type@entry=4112, data=data@entry=0x6d95a0) at ../subprojects/gstreamer/gst/gstpad.c:4698
#10 0x00007ffff7f0cc4b in gst_pad_push (pad=0x6b2840, buffer=buffer@entry=0x6d95a0) at ../subprojects/gstreamer/gst/gstpad.c:4817
#11 0x00007fffe96c2887 in gst_queue_push_one (queue=0x6b8150) at ../subprojects/gstreamer/plugins/elements/gstqueue.c:1388
#12 gst_queue_loop (pad=<optimized out>) at ../subprojects/gstreamer/plugins/elements/gstqueue.c:1541
#13 0x00007ffff7f4132c in gst_task_func (task=0x6d9170) at ../subprojects/gstreamer/gst/gsttask.c:384
#14 0x00007ffff7db7e54 in g_thread_pool_thread_proxy.lto_priv () at /lib64/libglib-2.0.so.0
#15 0x00007ffff7db52b2 in g_thread_proxy () at /lib64/libglib-2.0.so.0
#16 0x00007ffff7cbf3f9 in start_thread () at /lib64/libpthread.so.0
#17 0x00007ffff7bec903 in clone () at /lib64/libc.so.6
CC @gdesmott