voc / voctomix

Full-HD Software Live-Video-Mixer in python
https://c3voc.de/
MIT License
578 stars 106 forks source link

TCPAVSource crashed the core on reconnections #335

Open baldurmen opened 1 month ago

baldurmen commented 1 month ago

Hello!

When using the TCPAVSource, when the machine that pushes the datastream stops and then starts pushing again, voctocore crashes:

This first part happens when the source stops sending data:

WARNING TCPAVSource[cam2]: scheduling source restart
   DEBUG TCPAVSource[cam2]: restarting source 'cam2'
   DEBUG Pipeline: element state changed to 'PAUSED' by element 'tcpsrc-cam2'
   DEBUG Pipeline: element state changed to 'READY' by element 'tcpsrc-cam2'
   DEBUG Pipeline: element state changed to 'PAUSED' by element 'demux-cam2'
   DEBUG Pipeline: element state changed to 'READY' by element 'demux-cam2'
   DEBUG Pipeline: element state changed to 'PAUSED' by element 'demux-cam2'
   DEBUG Pipeline: element state changed to 'PLAYING' by element 'demux-cam2'
   DEBUG Pipeline: element state changed to 'PAUSED' by element 'tcpsrc-cam2'
   DEBUG Pipeline: element state changed to 'PLAYING' by element 'tcpsrc-cam2'

When it starts again, this happens:

   DEBUG TCPAVSource[cam2]: demuxer added pad w/ caps: video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)30/1
   DEBUG TCPAVSource[cam2]: new demuxer-pad is a video-pad, testing against configured video-caps
Traceback (most recent call last):
  File "/usr/share/voctomix/voctocore/lib/sources/tcpavsource.py", line 137, in on_pad_added
    self.demux.link(self.queue_audio)
TypeError: Argument 1 does not allow None as a value
   DEBUG TCPAVSource[cam2]: demuxer added pad w/ caps: audio/x-raw, format=(string)S16LE, layout=(string)interleaved, channel-mask=(bitmask)0x0000000000000003, channels=(int)2, rate=(int)48000
   DEBUG TCPAVSource[cam2]: new demuxer-pad is an audio-pad, testing against configured audio-caps
Traceback (most recent call last):
  File "/usr/share/voctomix/voctocore/lib/sources/tcpavsource.py", line 137, in on_pad_added
    self.demux.link(self.queue_audio)
TypeError: Argument 1 does not allow None as a value
 WARNING TCPAVSource[cam2]: scheduling source restart
   DEBUG Pipeline: ../libs/gst/base/gstbasesrc.c(3132): gst_base_src_loop (): /GstPipeline:pipeline0/GstBin:TCPAVSource-cam2/GstTCPServerSrc:tcpsrc-cam2:
streaming stopped, reason not-linked (-1)
   ERROR Pipeline: GStreamer pipeline element 'tcpsrc-cam2' signaled an error #1: Internal data stream error.

This basically makes TCPAVSource unusable :(

We're running voctomix 2.1.0 and gstreamer 1.22.0.

markvdb commented 1 month ago

See also:

At FOSDEM, we are successfully playing around with voctomix 2 ingesting from tcp sources with reconnect before voctomix using the gstreamer fallbacksrc plugin. Debian packaging situation still a PITA, but a possible workaround. See also:

stefanor commented 1 month ago

Our current workaround is: ffmpeg (that can die / restart) -> MPEG-TS stream -> Python Proxy that feeds incoming connections into a long-lived ffmpeg -> MKV -> Voctocore. Eeeeeew, but it handles restarts gracefully, which is what production needs.