bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
12.43k stars 1.54k forks source link

MediaMTX API / streams crash on RPi 4 when PATCHing configuration with 2 cameras #3943

Open marksutheran opened 2 weeks ago

marksutheran commented 2 weeks ago

Which version are you using?

v1.9.3

Which operating system are you using?

Linux arm64 Standalone binary

Describe how to replicate the issue

Problem Statement

When using dual cameras on RPi 4 attempting to adjust the libcam parameters via the API causes the mediamtx server API to crash along with the adjusted stream

n.b. this issue pre-dates release v1.9.3 but tests carried out on latest version to confirm the issue still exists.

Steps to recreate

Base scenario:

  1. Start the mediamtx process with single camera configuration (mediamtx.single.yml)
  2. Open a live stream to the camera (e.g. SRT using VLC - srt://{DEVICE ADDRESS}:8890/?streamid=read:cam0&latency=250)
  3. Send a PATCH command to the API
    • http://{DEVICE ADDRESS}:9997/v3/config/paths/patch/cam0
    • PATCH: {"rpiCameraVFlip": true, "rpiCameraHFlip":false}
  4. RESULT: Camera orientation flips as expected, no issues

Failure scenario:

  1. Start the mediamtx process with double camera configuration (mediamtx.double.yml)
  2. Open a live stream to the camera (e.g. SRT using VLC - srt://{DEVICE ADDRESS}:8890/?streamid=read:cam0&latency=250)
  3. Send a PATCH command to the API
    • http://{DEVICE ADDRESS}:9997/v3/config/paths/patch/cam0
    • PATCH: {"rpiCameraVFlip": true, "rpiCameraHFlip":false}
  4. RESULT:
    • API hangs, no further calls processed
    • PATCHed Camera stream fails, associated mtxrpicam process dies
    • Other camera stream continues as normal
    • mediamtx process needs to be restarted

Configuration files

'.txt' added to enable upload mediamtx.single.yml.txt mediamtx.double.yml.txt

Kernel

Linux raspberrypi 6.6.36-v8+ #2 SMP PREEMPT Tue Jul 9 13:02:03 +08 2024 aarch64 GNU/Linux

Logs

Log file attached with DEBUG level. Search for 'PATCH' string in the file

Workaround

Use multiple configuration files, symlink and restart mediamtx as necessary

Server logs

mediamtx.double.log

Network dump

No response