WebRTSP / ReStreamer

Media URLs ReStreamer and Cloud DVR
GNU General Public License v3.0
32 stars 6 forks source link

Double Clicking a stream on the UI #11

Closed eslam-ahmed-khair closed 2 years ago

eslam-ahmed-khair commented 2 years ago

Hello,

when double clicking a stream on the UI or switching streams back and forth so quickly the following errors show up:

(ReStreamer:60045): GStreamer-CRITICAL **: 11:51:45.306: gst_pad_add_probe: assertion 'GST_IS_PAD (pad)' failed

(ReStreamer:60045): GStreamer-CRITICAL **: 11:51:50.005: gst_bin_add_many: assertion 'GST_IS_BIN (bin)' failed
**
ERROR:/home/dev/Repos/ReStreamer/WebRTSP/RtStreaming/GstRtStreaming/GstWebRTCPeer2.cpp:639:void GstWebRTCPeer2::internalPrepare(): assertion failed: (false)
Bail out! ERROR:/home/dev/Repos/ReStreamer/WebRTSP/RtStreaming/GstRtStreaming/GstWebRTCPeer2.cpp:639:void GstWebRTCPeer2::internalPrepare(): assertion failed: (false)

Perhaps we need something to protect against such requests fired in quick successions.

Thanks!

eslam-ahmed-khair commented 2 years ago

I did some investigations.

This whole problem is related to the destruction of GstWebRTCPeer2 before being fully initialized (i.e. its pipelinePtr, teePtr, teeSrcPadPtr etc. and has not fully exchanged its ICE candidates). Before being fully initialized, those pointers might potentially be nullptr and whenever the second UI click kicks in, this causes a delete on the SessionContextData housing the uninitialized instance of GstWebRTCPeer2.

This error (ReStreamer:60045): GStreamer-CRITICAL **: 11:51:45.306: gst_pad_add_probe: assertion 'GST_IS_PAD (pad)' failed is because the teeSrcPadPtr is null when attempting to add the probe on the idle pad.

Furthermore, callbacks on this object starts to trigger (such as srcPadAdded or AddIceCandidate), only to find out it it's been destroyed!

RSATom commented 2 years ago

I've already found the reason. Fixing it right now.

RSATom commented 2 years ago

@eslam-ahmed-khair should be fixed now, please try.

eslam-ahmed-khair commented 2 years ago

Nice quick fix, Thank you!