Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Dasher: Segfault on config changed detected #3349

@jadarve

Description

@jadarve

I started to receive segmentation faults from GPAC when using it to transmux from TCP/TS to HLS and push to HTTP like this:

gpac -i tcp://my-transcoder:5020/:gpac:tsprobe=true:listen=false @@#PID=200 restamp:#Template=audio @@#PID=100 restamp:#Template=video_hd @@1 @@2 cecrypt:cfile=/etc/drm/gpac-drm-fairplay.xml @@3 -o http://origin:8081/live/upl\
oad/playlist.m3u8:gpac:buf=-150:ll_part_hb=-1:seg_sync=no:segdur=2.0:cdur=0.5:llhls=sf:hlsc=true:cmaf=cmf2:dmode=dynamic:pssh=mv:stl=true:hmode=push:rawsub=true -broken-cert

GPAC works correctly for several minutes, then the [Dasher] PID P1V3 config changed during active period, forcing period switch appears, and the process crashes.

[ADTSDmx] invalid ADTS sync bytes, resyncing
[MPEG-2 TS] PES 200: Packet discontinuity (10 expected - got 11) - may have lost end of previous PES
[MPEG-2 TS] PID 200 PES payload size 349 but received 346 bytes
[ADTSDmx] invalid next ADTS frame sync, resyncing
[ADTSDmx] invalid ADTS sync bytes, resyncing
[ADTSDmx] invalid next ADTS frame sync, resyncing
[ADTSDmx] invalid ADTS sync bytes, resyncing
[ADTSDmx] invalid ADTS sync bytes, resyncing
[MPEG-2 TS] PES 100: Packet discontinuity (15 expected - got 6) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (0 expected - got 7) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (13 expected - got 4) - trashing PES packet
[ADTSDmx] invalid ADTS sync bytes, resyncing
[MPEG-2 TS] PES 100: Packet discontinuity (2 expected - got 9) - trashing PES packet
[ADTSDmx] Unsupported multi-block ADTS frame header - patch welcome
[MPEG-2 TS] PES 100: Packet discontinuity (15 expected - got 6) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (14 expected - got 5) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (0 expected - got 7) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (9 expected - got 0) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (10 expected - got 1) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (6 expected - got 13) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (0 expected - got 7) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (11 expected - got 2) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (8 expected - got 15) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (6 expected - got 13) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (7 expected - got 14) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (11 expected - got 2) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (2 expected - got 9) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (5 expected - got 12) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (6 expected - got 13) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (13 expected - got 4) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (11 expected - got 2) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (0 expected - got 7) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (3 expected - got 10) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (5 expected - got 12) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (14 expected - got 8) - trashing PES packet
[MP4Mux] PID P1A4 ID 200 Sample 63298 with DTS 121529708 less than previous sample DTS 121531815, patching DTS
[MPEG-2 TS] PES 100: Packet discontinuity (7 expected - got 14) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (11 expected - got 2) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (4 expected - got 11) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (8 expected - got 15) - trashing PES packet
[MPEG-2 TS] PES 100: Packet discontinuity (12 expected - got 3) - trashing PES packet
[MPEG-2 TS] PES 301: Packet discontinuity (4 expected - got 5) - may have lost end of previous PES
[MPEG-2 TS] PID 301 PES payload size 201 but received 162 bytes
[Dasher] PID P1V3 config changed during active period, forcing period switch
Segmentation fault (core dumped)

Running the same command with valgrind it reports:

==11== Memcheck, a memory error detector
==11== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==11== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==11== Command: gpac -i tcp://gstreamer:5020/:gpac:tsprobe=true:listen=false @@#PID=200 restamp:#Template=audio_a298f39823 @@#PID=100 restamp:#Template=video_hd_d811b69c4c @@1 @@2 cecrypt:cfile=/etc/drm/gpac-drm-widevine-playready.xml @@#PID=301 restamp:#Template=tracking_0cef149538 @ rftsvtt @@3 @@5 -o http://origin:8081/live/upload/playlist.mpd:gpac:buf=-100:ll_part_hb=0:seg_sync=no:segdur=2.0:cdur=0.5:asto=1.8:profile=dashif.ll:hlsc=true:cmaf=cmf2:dmode=dynamic:pssh=mv:stl=true:hmode=push:rawsub=false:inband_event:utcs=https://time.akamai.com/?iso -broken-cert
==11== Parent PID: 1
==11== 
==11== Invalid read of size 4
==11==    at 0x4ED6EC8: gf_filter_pid_is_eos (filter_pid.c:7364)
==11==    by 0x50ACACE: httpout_process_inputs (out_http.c:4886)
==11==    by 0x50AEB4F: httpout_process (out_http.c:5454)
==11==    by 0x4F05042: gf_filter_process_task (filter.c:3208)
==11==    by 0x4EEF9CE: gf_fs_thread_proc (filter_session.c:2393)
==11==    by 0x4EF043F: gf_fs_run (filter_session.c:2697)
==11==    by 0x11605F: gpac_main (gpac.c:1560)
==11==    by 0x1164CA: main (gpac.c:1820)
==11==  Address 0x2c8 is not stack'd, malloc'd or (recently) free'd
==11== 
==11== 
==11== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==11==  Access not within mapped region at address 0x2C8
==11==    at 0x4ED6EC8: gf_filter_pid_is_eos (filter_pid.c:7364)
==11==    by 0x50ACACE: httpout_process_inputs (out_http.c:4886)
==11==    by 0x50AEB4F: httpout_process (out_http.c:5454)
==11==    by 0x4F05042: gf_filter_process_task (filter.c:3208)
==11==    by 0x4EEF9CE: gf_fs_thread_proc (filter_session.c:2393)
==11==    by 0x4EF043F: gf_fs_run (filter_session.c:2697)
==11==    by 0x11605F: gpac_main (gpac.c:1560)
==11==    by 0x1164CA: main (gpac.c:1820)
==11==  If you believe this happened as a result of a stack
==11==  overflow in your program's main thread (unlikely but
==11==  possible), you can try to increase the size of the
==11==  main thread stack using the --main-stacksize= flag.
==11==  The main thread stack size used in this run was 8388608.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions