| 1 | /********** |
| 2 | This library is free software; you can redistribute it and/or modify it under |
| 3 | the terms of the GNU Lesser General Public License as published by the |
| 4 | Free Software Foundation; either version 3 of the License, or (at your |
| 5 | option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) |
| 6 | |
| 7 | This library is distributed in the hope that it will be useful, but WITHOUT |
| 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
| 10 | more details. |
| 11 | |
| 12 | You should have received a copy of the GNU Lesser General Public License |
| 13 | along with this library; if not, write to the Free Software Foundation, Inc., |
| 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 15 | **********/ |
| 16 | // "liveMedia" |
| 17 | // Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved. |
| 18 | // A 'ServerMediaSubsession' object that represents an existing |
| 19 | // 'RTPSink', rather than one that creates new 'RTPSink's on demand. |
| 20 | // C++ header |
| 21 | |
| 22 | #ifndef _PASSIVE_SERVER_MEDIA_SUBSESSION_HH |
| 23 | #define _PASSIVE_SERVER_MEDIA_SUBSESSION_HH |
| 24 | |
| 25 | #ifndef _SERVER_MEDIA_SESSION_HH |
| 26 | #include "ServerMediaSession.hh" |
| 27 | #endif |
| 28 | |
| 29 | #ifndef _RTP_SINK_HH |
| 30 | #include "RTPSink.hh" |
| 31 | #endif |
| 32 | #ifndef _RTCP_HH |
| 33 | #include "RTCP.hh" |
| 34 | #endif |
| 35 | |
| 36 | class PassiveServerMediaSubsession: public ServerMediaSubsession { |
| 37 | public: |
| 38 | static PassiveServerMediaSubsession* createNew(RTPSink& rtpSink, |
| 39 | RTCPInstance* rtcpInstance = NULL); |
| 40 | |
| 41 | protected: |
| 42 | PassiveServerMediaSubsession(RTPSink& rtpSink, RTCPInstance* rtcpInstance); |
| 43 | // called only by createNew(); |
| 44 | virtual ~PassiveServerMediaSubsession(); |
| 45 | |
| 46 | virtual Boolean rtcpIsMuxed(); |
| 47 | |
| 48 | protected: // redefined virtual functions |
| 49 | virtual char const* sdpLines(); |
| 50 | virtual void getStreamParameters(unsigned clientSessionId, |
| 51 | netAddressBits clientAddress, |
| 52 | Port const& clientRTPPort, |
| 53 | Port const& clientRTCPPort, |
| 54 | int tcpSocketNum, |
| 55 | unsigned char rtpChannelId, |
| 56 | unsigned char rtcpChannelId, |
| 57 | netAddressBits& destinationAddress, |
| 58 | u_int8_t& destinationTTL, |
| 59 | Boolean& isMulticast, |
| 60 | Port& serverRTPPort, |
| 61 | Port& serverRTCPPort, |
| 62 | void*& streamToken); |
| 63 | virtual void startStream(unsigned clientSessionId, void* streamToken, |
| 64 | TaskFunc* rtcpRRHandler, |
| 65 | void* rtcpRRHandlerClientData, |
| 66 | unsigned short& rtpSeqNum, |
| 67 | unsigned& rtpTimestamp, |
| 68 | ServerRequestAlternativeByteHandler* serverRequestAlternativeByteHandler, |
| 69 | void* serverRequestAlternativeByteHandlerClientData); |
| 70 | virtual float getCurrentNPT(void* streamToken); |
| 71 | virtual void getRTPSinkandRTCP(void* streamToken, |
| 72 | RTPSink const*& rtpSink, RTCPInstance const*& rtcp); |
| 73 | virtual void deleteStream(unsigned clientSessionId, void*& streamToken); |
| 74 | |
| 75 | protected: |
| 76 | char* fSDPLines; |
| 77 | RTPSink& fRTPSink; |
| 78 | RTCPInstance* fRTCPInstance; |
| 79 | HashTable* fClientRTCPSourceRecords; // indexed by client session id; used to implement RTCP "RR" handling |
| 80 | }; |
| 81 | |
| 82 | #endif |
| 83 | |