- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue

Repository with a docker-compose to reproduce the issue: https://github.com/jadarve/gpac_experiments

I'm using GPAC as an RTMP server to mux the incoming stream to produce a DASH stream. The producer is a GStreamer pipeline pushing the content to GPAC. When GStreamer starts pushing, GPAC segfaults with little information about the error:

```
gpac           | [flv] rfps: 240.000000 0.004160
gpac           | [flv] rfps: 29.970030 0.000191
gpac           | [flv] rfps: 29.970030 0.000191
gpac           | [flv] rfps: 59.940060 0.000765
gpac           | [flv] rfps: 59.940060 0.000765
gpac           | [flv] stream 0: start_time: 0 duration: NOPTS
gpac           | [flv] stream 1: start_time: 0 duration: NOPTS
gpac           | [flv] stream 2: start_time: 0.266 duration: NOPTS
gpac           | [flv] format: start_time: 0 duration: NOPTS (estimate from bit rate) bitrate=2753 kb/s
gpac           | [flv] After avformat_find_stream_info() pos: 410330 bytes read:410330 seeks:0 frames:104
gpac           | Segmentation fault (core dumped)
``` 

### Gpac command

```shell
gpac -i rtmp://:1935/live:gpac:rtmp_listen=1 \
    -o /tmp/workdir/content/playlist.mpd:dmode=dynamic \
    -graph \
    -logs=all@debug
``` 

### GStreamer command

```shell
export PUSH_URL=rtmp://gpac:1935/live/live

gst-launch-1.0 -e \
    videotestsrc ! "video/x-raw,height=720,width=1280" ! queue ! tee name=video_raw_tee \
    audiotestsrc wave=ticks apply-tick-ramp=true tick-interval=100000000 freq=10000 volume=0.4 marker-tick-period=10 sine-periods-per-tick=20 ! queue ! tee name=audio_raw_tee \
    \
    video_raw_tee. ! queue name=video_scale_queue ! videoscale ! video/x-raw,height=240,width=360 ! tee name=video_scale_tee \
    \
    video_scale_tee. ! queue name=video_transcode_enc_queue ! videoconvert ! "video/x-raw,format=I420" ! \
        x264enc bitrate=2000 byte-stream=true key-int-max=25 bframes=0 aud=true tune=zerolatency pass=cbr ! \
        "video/x-h264,profile=baseline,stream-format=avc" ! h264parse config-interval=-1 ! tee name=video_transcoded_enc_tee \
    \
    audio_raw_tee. ! queue name=audio_enc_queue ! audioresample ! "audio/x-raw,rate=44100" ! tee name=audio_resample_tee \
    audio_resample_tee. ! queue ! audioconvert ! "audio/x-raw,channels=2" ! avenc_aac name=audio_encoder ! "audio/mpeg" ! aacparse ! tee name=audio_encoder_tee \
    \
    video_transcoded_enc_tee. ! queue name=video_transcoded_queue ! flvmux streamable=true name=flv_mux_transcoded ! tee name=flv_mux_transcoded_tee \
    audio_resample_tee. ! queue ! audioconvert ! flv_mux_transcoded. \
    \
    flv_mux_transcoded_tee. ! queue ! rtmpsink location="${PUSH_URL} live=1" name=rtmp_sink_transcoded
``` 

While the problem might be in the configuration of the [`x264enc`](https://gstreamer.freedesktop.org/documentation/x264/index.html?gi-language=c#x264enc), the segfault in GPAC's side makes it difficult to spot the problem.

You could use the docker-compose of the repo above to reproduce the issue:

```shell
# build containers
docker build -t gpac_experiments:http_origin -f containers/http_origin.dockerfile .
docker build -t gpac_experiments:gstreamer -f containers/gstreamer.dockerfile .
docker build -t gpac_experiments:gpac -f containers/gpac.dockerfile .

# run the example
cd 0-dash
docker-compose up
```

Any help will be much appreciated.
Receiving RTMP stream from GStreamer makes GPAC to segfault
This is a GitHub Issue
repo:gpac
owner:gpac
Title : Receiving RTMP stream from GStreamer makes GPAC to segfault
Issue date:

--- start body ---
- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue

Repository with a docker-compose to reproduce the issue: https://github.com/jadarve/gpac_experiments

I'm using GPAC as an RTMP server to mux the incoming stream to produce a DASH stream. The producer is a GStreamer pipeline pushing the content to GPAC. When GStreamer starts pushing, GPAC segfaults with little information about the error:

```
gpac           | [flv] rfps: 240.000000 0.004160
gpac           | [flv] rfps: 29.970030 0.000191
gpac           | [flv] rfps: 29.970030 0.000191
gpac           | [flv] rfps: 59.940060 0.000765
gpac           | [flv] rfps: 59.940060 0.000765
gpac           | [flv] stream 0: start_time: 0 duration: NOPTS
gpac           | [flv] stream 1: start_time: 0 duration: NOPTS
gpac           | [flv] stream 2: start_time: 0.266 duration: NOPTS
gpac           | [flv] format: start_time: 0 duration: NOPTS (estimate from bit rate) bitrate=2753 kb/s
gpac           | [flv] After avformat_find_stream_info() pos: 410330 bytes read:410330 seeks:0 frames:104
gpac           | Segmentation fault (core dumped)
``` 

### Gpac command

```shell
gpac -i rtmp://:1935/live:gpac:rtmp_listen=1 \
    -o /tmp/workdir/content/playlist.mpd:dmode=dynamic \
    -graph \
    -logs=all@debug
``` 

### GStreamer command

```shell
export PUSH_URL=rtmp://gpac:1935/live/live

gst-launch-1.0 -e \
    videotestsrc ! "video/x-raw,height=720,width=1280" ! queue ! tee name=video_raw_tee \
    audiotestsrc wave=ticks apply-tick-ramp=true tick-interval=100000000 freq=10000 volume=0.4 marker-tick-period=10 sine-periods-per-tick=20 ! queue ! tee name=audio_raw_tee \
    \
    video_raw_tee. ! queue name=video_scale_queue ! videoscale ! video/x-raw,height=240,width=360 ! tee name=video_scale_tee \
    \
    video_scale_tee. ! queue name=video_transcode_enc_queue ! videoconvert ! "video/x-raw,format=I420" ! \
        x264enc bitrate=2000 byte-stream=true key-int-max=25 bframes=0 aud=true tune=zerolatency pass=cbr ! \
        "video/x-h264,profile=baseline,stream-format=avc" ! h264parse config-interval=-1 ! tee name=video_transcoded_enc_tee \
    \
    audio_raw_tee. ! queue name=audio_enc_queue ! audioresample ! "audio/x-raw,rate=44100" ! tee name=audio_resample_tee \
    audio_resample_tee. ! queue ! audioconvert ! "audio/x-raw,channels=2" ! avenc_aac name=audio_encoder ! "audio/mpeg" ! aacparse ! tee name=audio_encoder_tee \
    \
    video_transcoded_enc_tee. ! queue name=video_transcoded_queue ! flvmux streamable=true name=flv_mux_transcoded ! tee name=flv_mux_transcoded_tee \
    audio_resample_tee. ! queue ! audioconvert ! flv_mux_transcoded. \
    \
    flv_mux_transcoded_tee. ! queue ! rtmpsink location="${PUSH_URL} live=1" name=rtmp_sink_transcoded
``` 

While the problem might be in the configuration of the [`x264enc`](https://gstreamer.freedesktop.org/documentation/x264/index.html?gi-language=c#x264enc), the segfault in GPAC's side makes it difficult to spot the problem.

You could use the docker-compose of the repo above to reproduce the issue:

```shell
# build containers
docker build -t gpac_experiments:http_origin -f containers/http_origin.dockerfile .
docker build -t gpac_experiments:gstreamer -f containers/gstreamer.dockerfile .
docker build -t gpac_experiments:gpac -f containers/gpac.dockerfile .

# run the example
cd 0-dash
docker-compose up
```

Any help will be much appreciated.
--- end body ---

A segmentation fault in GPAC when receiving an RTMP stream from GStreamer indicates a potential vulnerability that could be exploited to crash the application. The issue arises when GPAC attempts to process the incoming stream, leading to a crash without proper error handling. This could be leveraged by an attacker to disrupt service by sending malformed or unexpected streams.