GNOME Bugzilla – Bug 772200
gst_audio_buffer_clip() gsize underrun
Last modified: 2016-10-20 13:45:04 UTC
Program received signal SIGTRAP, Trace/breakpoint trap.
+ Trace 236713
Thread 140736406218496 (LWP 21227)
(gdb) call g_type_name(((GTypeClass*)(((GTypeInstance*) (btrans))->g_class))->g_type) $1 = (const gchar *) 0x7fffc83dc2a8 "GstVolume" tail -n20 /tmp/debug.log | grep 'audio' 0:00:25.007546763 23712 0x3106c50 DEBUG audio audio.c:108:gst_audio_buffer_clip: timestamp 0:00:07.625000000 0:00:25.007661049 23712 0x3106c50 LOG audio audio.c:142:gst_audio_buffer_clip: orig: 7625000000..7750000000 clipped 7625000000..7680000000 0:00:25.007699559 23712 0x3106c50 LOG audio audio.c:169:gst_audio_buffer_clip: clip stop: 6174 size 18446744073709550294 0:00:25.007744722 23712 0x3106c50 DEBUG audio audio.c:229:gst_audio_buffer_clip: trim 0 size 18446744073709550294 osize 4852 size was 4852 and becomes 18446744073709550294 trying to fix and ideally come up with a test
super weird, it just stopped happening. Downgrading the blocker status.
It is happening again. Audio is playing at 1/4 speed and this triggers the bad clipping. There are definitely bugs in the clipping for which I have patches. Still not sure what is messing up the rate.
The low speed is a bug with distributing the tempo context in the pipeline.
You say you have patches, can you attach them? :) Do you know what the exact arguments to gst_audio_buffer_clip() are that break it (so we can write tests)?
Created attachment 337710 [details] [review] don't deref NULL when gst_buffer_copy_region() failed Ideally the parameters would be always valid.
Created attachment 337711 [details] [review] more diagnostics I am still working on a cut-down repro
It is essentially a bug on my side. My baseclass created buffers where duration and size was inconsistent at eof. Not sure how much we want to be forgiving here. before the fix: 0:00:39.565873018 21337 0x41a1000 DEBUG audiosynth src/lib/gst/audiosynth.c:440:gstbt_audio_synth_create:<simsyn:simsyn> generate_samples 5512, offset 77175, offset_end 82687 timestamp 0:00:01.750000000, duration 0:00:00.125000000 0:00:39.689102484 21337 0x41a1000 INFO audiosynth src/lib/gst/audiosynth.c:377:gstbt_audio_synth_create:<simsyn:simsyn> partial buffer: 1985 0:00:39.689177367 21337 0x41a1000 DEBUG audiosynth src/lib/gst/audiosynth.c:440:gstbt_audio_synth_create:<simsyn:simsyn> generate_samples 1985, offset 82687, offset_end 84672 timestamp 0:00:01.875000000, duration 0:00:00.125000000 0:00:39.689233702 21337 0x41a1000 DEBUG audio audio.c:108:gst_audio_buffer_clip: timestamp 0:00:01.875000000 0:00:39.689266587 21337 0x41a1000 LOG audio audio.c:169:gst_audio_buffer_clip: clip.stop size = 3970 - 7056 0:00:39.689279606 21337 0x41a1000 WARN audio audio.c:171:gst_audio_buffer_clip: adjustment=7056 > size 3970 0:00:39.689290727 21337 0x41a1000 DEBUG audio audio.c:242:gst_audio_buffer_clip: trim 0 size 18446744073709548530 osize 3970 after fix: 0:00:15.463033287 29169 0x3364ad0 DEBUG audiosynth src/lib/gst/audiosynth.c:443:gstbt_audio_synth_create:<simsyn:simsyn> generate_samples 5512, offset 77175, offset_end 82687 timestamp 0:00:01.750000000, duration 0:00:00.125000000 0:00:15.586788512 29169 0x3364ad0 INFO audiosynth src/lib/gst/audiosynth.c:377:gstbt_audio_synth_create:<simsyn:simsyn> partial buffer: 1985 0:00:15.586884460 29169 0x3364ad0 DEBUG audiosynth src/lib/gst/audiosynth.c:443:gstbt_audio_synth_create:<simsyn:simsyn> generate_samples 1985, offset 82687, offset_end 84672 timestamp 0:00: 01.875000000, duration 0:00:00.000000000 0:00:15.712021425 29169 0x3364ad0 WARN audiosynth src/lib/gst/audiosynth.c:338:gstbt_audio_synth_create:<simsyn:simsyn> EOS reached
Created attachment 337738 [details] before after log snippet since the comment gets wrapped, here's it again
Figured it, doing tests. Need to cleanup the existing ones first.
Okay, 100% sure it is user error. I sent bad buffers. I cleanup the tests and added one more. I am fine with closing this. Any opinion on the "don't deref NULL when gst_buffer_copy_region() failed" patch? It should not really happen.
Review of attachment 337710 [details] [review]: Being more careful is always good :) Feel free to drop or push this and close the bug.
ACK, also feel free to add more checks to guard against invalid parameters (but not against invalid buffers).
Comment on attachment 337710 [details] [review] don't deref NULL when gst_buffer_copy_region() failed Added a GST_ERROR on in the failure case.
Closing the bug, since the root cause is in the element that created the buffer.