videoLIVE555Source:
- _stop() tore the stream down on the caller's thread while the live555
thread was still inside doEventLoop(), and deleted the RTSP client, the
environment and the scheduler under the running loop. Now it ends the
loop, joins the thread, then closes what is left on its own thread.
- shutdownStream() no longer deletes the scheduler/environment (a second
shutdown, e.g. _close() then the destructor or a live555 callback then
the destructor, used them after they were freed). Only the destructor
frees them, once. A second shutdown is a no-op.
- m_pRtspClient and the other pointers are initialised: a source that was
never opened, or failed to open, shut down a random pointer.
- The event-loop flag is reset in _open(), not at thread start, so a stop
issued before the thread ran is not lost.
- shutdownStream closes the subsession sinks and sends TEARDOWN, as
live555 testRTSPClient does. The sinks were never closed and leaked.
- continueAfterPLAY frees resultString.
DummySink:
- Every pointer is NULL-initialised before the constructor can return
early. The destructor freed an uninitialised m_pFrame when the codec
was not found or in stream-proxy mode.
- Decode resources are created whenever DECODE_FRAMES is set, also
together with STREAM_PROXY (deviceNodeCamera uses both). They were
used uninitialised. Decoding is skipped if any of them is missing.
- m_sAvPkt is zeroed (av_packet_unref() frees opaque_ref/side_data).
- The destructor frees the frames, the RGB buffer, the scaler, the codec
context, the output format context and dictionary, and m_pH264. The
trailer is written only after a written header.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16