From 1ad7722a67d57789afe8ece52d33a0e344797fa2 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 9 Jan 2024 15:49:55 +0100 Subject: [PATCH] RTSP: support stream redirect When the client doesn't call TEARDOWN (like ffplay doesn't), the stream could not have been played until the timeout (given by `reclamationTestSeconds`). After that (or when TEARDOWN was called), `BasicRTSPOnlySubsession::deleteStream()` is called allowing the new stream. After this change, the stream can be redirected withot explicit TEARDOWN or timeout. --- src/rtsp/BasicRTSPOnlySubsession.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rtsp/BasicRTSPOnlySubsession.cpp b/src/rtsp/BasicRTSPOnlySubsession.cpp index adb1416b4..60b480c1c 100644 --- a/src/rtsp/BasicRTSPOnlySubsession.cpp +++ b/src/rtsp/BasicRTSPOnlySubsession.cpp @@ -89,8 +89,6 @@ char const* BasicRTSPOnlySubsession::sdpLines() { if (fSDPLines == NULL) { setSDPLines(); } - if (Adestination != NULL || Vdestination != NULL) - return NULL; return fSDPLines; } @@ -189,7 +187,7 @@ void BasicRTSPOnlySubsession::getStreamParameters(unsigned /* clientSessionId */ netAddressBits& destinationAddress, uint8_t& /*destinationTTL*/, Boolean& /* isMulticast */, Port& serverRTPPort, Port& serverRTCPPort, void*& /* streamToken */) { - if (Vdestination == NULL && (avType == video || avType == av)) { + if (avType == video || avType == av) { Port rtp(rtp_port); serverRTPPort = rtp; Port rtcp(rtp_port + 1); @@ -203,10 +201,11 @@ void BasicRTSPOnlySubsession::getStreamParameters(unsigned /* clientSessionId */ } struct in_addr destinationAddr; destinationAddr.s_addr = destinationAddress; + delete Vdestination; Vdestination = new Destinations(destinationAddr, clientRTPPort, clientRTCPPort); } - if (Adestination == NULL && (avType == audio || avType == av)) { + if (avType == audio || avType == av) { Port rtp(rtp_port_audio); serverRTPPort = rtp; Port rtcp(rtp_port_audio + 1); @@ -220,6 +219,7 @@ void BasicRTSPOnlySubsession::getStreamParameters(unsigned /* clientSessionId */ } struct in_addr destinationAddr; destinationAddr.s_addr = destinationAddress; + delete Adestination; Adestination = new Destinations(destinationAddr, clientRTPPort, clientRTCPPort); }