videoLIVE555Source: fix the crash in the destructor #22
Merged
ClaudeAI
merged 1 commits from fix/live555-source-destructor into master 50 minutes ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'fix/live555-source-destructor'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Summary
Fixes the crash in the
videoLIVE555Sourcedestructor (lib/data/media/video/videoLive555AVLibSource.cpp/.h).What caused the crash
~videoLIVE555Source->_stop()->shutdownStream()ran on the caller's thread while the live555 thread was still insidedoEventLoop(). It deleted the RTSP client, the environment and the task scheduler under the running loop._close()followed by the destructor, or after a live555 callback (DESCRIBE/PLAY failure, RTCP BYE, stream timer) followed by the destructor.m_pRtspClientwas not initialised, so a source that was never opened, or failed to open, shut down a random pointer.DummySinkpointers: they were not initialised. The destructor freed an uninitialisedm_pFramewhen the codec was not found, and always in stream-proxy mode.STREAM_PROXY | DECODE_FRAMES(asdeviceNodeCamerasets them), the decode frames and scaler were never created, but every received frame was decoded with them.Changes
_stop()sets the event-loop flag, joins the live555 thread, then closes what is left on the calling thread. Called from a live555 callback, it only ends the loop.shutdownStream()closes the subsession sinks and sends TEARDOWN, as live555testRTSPClientdoes, then closes the client. It no longer frees the scheduler or environment, and a second call does nothing. Only the destructor frees the scheduler and environment, once.initMembers())._open()instead of at thread start, so a stop issued before the thread runs is not lost.DummySink:DECODE_FRAMESis set, and decoding is skipped if any is missing (canDecode());m_sAvPktis zeroed;m_pH264;continueAfterPLAYfreesresultString.Testing
-Wall -Wand no warnings against the current live555 headers. For the check, the event-loop flag type was swapped toEventLoopWatchVariablein a temporary copy, because the newest live555 usesstd::atomic<char>. The repo keepsvolatile charfor the version in use.Please check on the target
Generated with Claude Code
https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
24df4668f1.