mpegtsmux: test_align sometimes goes into an infinite loop
Thread 1 (Thread 0x7fa92483e140 (LWP 2747)):
#0 0x00007fa9256a761f in tsmux_stream_consume (stream=stream@entry=0x55bc337da180, len=len@entry=0) at tsmuxstream.c:304
#1 0x00007fa9256a7fdc in tsmux_stream_get_data (stream=stream@entry=0x55bc337da180, buf=0x55bc339dba5a "", len=162)
at tsmuxstream.c:529
#2 0x00007fa9256a730d in tsmux_write_stream_packet (mux=0x55bc337ba890, stream=0x55bc337da180) at tsmux.c:1145
#3 0x00007fa9256a1733 in mpegtsmux_collected_buffer
(pads=pads@entry=0x55bc337ce0d0 [GstCollectPads], data=data@entry=0x55bc337d9c40, buf=0x55bc347c21c0, mux=mux@entry=0x55bc337cb080 [MpegTsMux]) at mpegtsmux.c:1483
#4 0x00007fa92572ed6d in gst_collect_pads_default_collected (pads=0x55bc337ce0d0 [GstCollectPads], user_data=<optimized out>)
at gstcollectpads.c:1557
#5 0x00007fa92572be58 in gst_collect_pads_check_collected (pads=pads@entry=0x55bc337ce0d0 [GstCollectPads])
at gstcollectpads.c:1358
#6 0x00007fa92572d810 in gst_collect_pads_chain (pad=0x55bc337cc650 [GstPad], parent=<optimized out>, buffer=0x55bc347c21c0)
at gstcollectpads.c:2213
#7 0x00007fa925425602 in gst_pad_chain_data_unchecked (data=0x55bc347c21c0, type=4112, pad=0x55bc337cc650 [GstPad])
at gstpad.c:4322
#8 0x00007fa925425602 in gst_pad_push_data
(pad=pad@entry=0x55bc337cc400 [GstPad], type=type@entry=4112, data=data@entry=0x55bc347c21c0) at gstpad.c:4578
#9 0x00007fa92542be02 in gst_pad_push (pad=0x55bc337cc400 [GstPad], buffer=0x55bc347c21c0) at gstpad.c:4697
#10 0x000055bc31953c25 in check_tsmux_pad
(srctemplate=<optimized out>, src_caps_string=<optimized out>, pes_id=224, pmt_id=27, check_func=0x55bc319529e0 <test_align_check_output>, n_bufs=817, input_buf_size=-1, alignment=7, sinkname=0x55bc319561c9 "sink_%d") at elements/mpegtsmux.c:197
#11 0x000055bc31954821 in test_align (__i__=<optimized out>) at elements/mpegtsmux.c:771
#12 0x00007fa9256cf619 in tcase_run_tfun_fork (i=0, tfun=0x55bc337b96b0, tc=0x55bc337d1fa0, sr=0x55bc337d1f50) at check_run.c:465
#13 0x00007fa9256cf619 in srunner_iterate_tcase_tfuns (tc=0x55bc337d1fa0, sr=0x55bc337d1f50) at check_run.c:237
#14 0x00007fa9256cf619 in srunner_run_tcase (tc=0x55bc337d1fa0, sr=0x55bc337d1f50) at check_run.c:377
#15 0x00007fa9256cf619 in srunner_iterate_suites
(print_mode=CK_SILENT, exclude_tags=0x0, include_tags=0x0, tcname=0x0, sname=0x0, sr=0x55bc337d1f50) at check_run.c:205
#16 0x00007fa9256cf619 in srunner_run_tagged
(sr=sr@entry=0x55bc337d1f50, sname=sname@entry=0x0, tcname=tcname@entry=0x0, include_tags=include_tags@entry=0x0, exclude_tags=exclude_tags@entry=0x0, print_mode=print_mode@entry=CK_NORMAL) at check_run.c:740
--Type <RET> for more, q to quit, c to continue without paging--
#17 0x00007fa9256cfc2d in srunner_run
(sr=sr@entry=0x55bc337d1f50, sname=sname@entry=0x0, tcname=tcname@entry=0x0, print_mode=print_mode@entry=CK_NORMAL)
at check_run.c:754
#18 0x00007fa9256cfc3b in srunner_run_all (sr=sr@entry=0x55bc337d1f50, print_mode=print_mode@entry=CK_NORMAL) at check_run.c:692
#19 0x00007fa9256c405d in gst_check_run_suite
(suite=<optimized out>, name=0x55bc31956170 "mpegtsmux", fname=0x55bc31956004 "elements/mpegtsmux.c") at gstcheck.c:1067
#20 0x000055bc3195250a in main (argc=<optimized out>, argv=<optimized out>) at elements/mpegtsmux.c:826
Problem is that the loop tries to consume 0 bytes forever
527 if (avail < len) {
(gdb) print avail
$3 = 0
(gdb) print len
$4 = 162
(gdb) next
528 memcpy (buf, cur, avail);
(gdb)
529 tsmux_stream_consume (stream, avail);
(gdb)
531 buf += avail;
(gdb)
532 len -= avail;
(gdb)