[Live-devel] Condition for pause of sub-stream in ProxyServerMediaSubsession::closeStreamSource

Erik Montnemery erik at montnemery.com
Tue Sep 27 14:28:10 PDT 2016


Hi,

I have a question about the PAUSE logic in
ProxyServerMediaSubsession::closeStreamSource.

Consider the following scenario:
Proxy server is proxying a stream with two subsessions:
- RTP/video/H264
- RTP/audio/MPEG4-GENERIC

Client A connects to the proxy and does a SETUP specifically for the
video substream over TCP:
SETUP rtsp://192.168.0.105/proxyStream-2/track1 RTSP/1.0\\r\\n
RTP/AVP/TCP;unicast;interleaved=0-1

RTSPServer::RTSPClientSession::handleCmd_SETUP increments
session->referenceCount() to 1

Connection to client A is interrupted (TCP connection torn down), which causes:
RTSPServer::RTSPClientConnection::~RTSPClientConnection
  RTSPServer::RTSPClientConnection::closeSocketsRTSP
    RTSPServer::RTSPClientSession::deleteStreamByTrack - Only the
video track will be deleted
      OnDemandServerMediaSubsession::deleteStream
        StreamState::~StreamState()
          StreamState::reclaim()
            ProxyServerMediaSubsession[rtsp://192.168.0.126/ch0_0.h264/,H264]::closeStreamSource()
The session reference counter is NOT decremented, and remains at 1,
because there was no TEARDOWN of the session.

Client B connects to the proxy and does a SETUP specifically for the
video substream over TCP:
SETUP rtsp://192.168.0.105/proxyStream-2/track1 RTSP/1.0\\r\\n
RTP/AVP/TCP;unicast;interleaved=0-1

RTSPServer::RTSPClientSession::handleCmd_SETUP increments
session->referenceCount() to 2

Connection to client B is interrupted (TCP connection torn down), the
same sequence is triggered as when the connection to client A was
interrupted.
However, this code in ProxyServerMediaSubsession::closeStreamSource is
now triggered because the reference counter is 2:
if (fParentSession->referenceCount() > 1) {
        // There are other client(s) still streaming other subsessions
of this stream.
        // Therefore, we don't send a "PAUSE" for the whole stream,
but only for the sub-stream:

The logic seems a bit odd: There is no other client streaming the
audio subsession.
Is this behavior correct?

/Erik


More information about the live-devel mailing list