Changeset 53


Ignore:
Timestamp:
08/04/10 19:56:40 (18 months ago)
Author:
shiretu
Message:

-- added proper stream naming for rtsp streams

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/builders/cmake/rtmpserver/rtmpserver.lua

    r41 r53  
    149149                                --[[{ 
    150150                                        url="rtsp://82.177.67.61/axis-media/media.amp", 
     151                                        streamName="stream1", 
    151152                                        forceTcp=false 
    152                                 }, 
    153                                 { 
    154                                         url="rtsp://217.153.33.206/axis-media/media.amp", 
    155                                         forceTcp=true 
    156153                                }, 
    157154                                { 
  • trunk/sources/thelib/include/protocols/rtp/connectivity/inboundconnectivity.h

    r49 r53  
    5353        void EnqueueForDelete(); 
    5454 
    55         bool Initialize(Variant &videoTrack, Variant &audioTrack, bool forceTcp); 
     55        bool Initialize(Variant &videoTrack, Variant &audioTrack, 
     56                        string streamName, bool forceTcp); 
    5657 
    5758        string GetTransportHeaderLine(bool isAudio); 
  • trunk/sources/thelib/include/protocols/rtp/rtspprotocol.h

    r49 r53  
    9191 
    9292        InboundConnectivity *GetInboundConnectivity(Variant &videoTrack, 
    93                         Variant &audioTrack); 
     93                        Variant &audioTrack, string sdpStreamName); 
    9494        void CloseInboundConnectivity(); 
    9595 
  • trunk/sources/thelib/include/protocols/rtp/sdp.h

    r49 r53  
    5858        static bool ParseSDP(SDP &sdp, string &raw); 
    5959        Variant GetVideoTrack(uint32_t index, string uri); 
     60        string GetStreamName(); 
    6061private: 
    6162        static bool ParseSection(Variant &result, vector<string> &lines, 
  • trunk/sources/thelib/src/protocols/rtp/basertspappprotocolhandler.cpp

    r49 r53  
    488488                        requestHeaders[RTSP_FIRST_LINE][RTSP_URL]); 
    489489        Variant audioTrack; 
    490         FINEST("videoTrack:\n%s", STR(videoTrack.ToString())); 
     490        //FINEST("videoTrack:\n%s", STR(videoTrack.ToString())); 
    491491 
    492492 
    493493        //5. Create the inbound connectivity 
    494         if (pFrom->GetInboundConnectivity(videoTrack, audioTrack) == NULL) { 
     494        if (pFrom->GetInboundConnectivity(videoTrack, audioTrack, 
     495                        sdp.GetStreamName()) == NULL) { 
    495496                FATAL("Unable to get the inbound connectivity"); 
    496497                return false; 
  • trunk/sources/thelib/src/protocols/rtp/connectivity/inboundconnectivity.cpp

    r49 r53  
    5454 
    5555bool InboundConnectivity::Initialize(Variant &videoTrack, Variant &audioTrack, 
    56                 bool forceTcp) { 
     56                string streamName, bool forceTcp) { 
    5757        _forceTcp = forceTcp; 
    5858 
     
    8787 
    8888        //5. Create the in stream 
     89        if (streamName == "") 
     90                streamName = format("rtsp_%d", _pRTSP->GetId()); 
    8991        _pInStream = new InNetRTPStream(_pRTSP, pApplication->GetStreamsManager(), 
    90                         format("rtsp_%d", _pRTSP->GetId()), 
     92                        streamName, 
    9193                        unb64((string) SDP_VIDEO_CODEC_H264_SPS(videoTrack)), 
    9294                        unb64((string) SDP_VIDEO_CODEC_H264_PPS(videoTrack))); 
     
    214216        //FINEST("%s:%d length: %d", inet_ntoa(address.sin_addr), ntohs(address.sin_port), length); 
    215217        return sendto(pRTCP->GetIOHandler()->GetOutboundFd(), 
    216                         (char *)pBuffer, length, 0, (sockaddr *) & address, sizeof (address)) == (int32_t) length; 
     218                        (char *) pBuffer, length, 0, (sockaddr *) & address, sizeof (address)) == (int32_t) length; 
    217219} 
    218220 
  • trunk/sources/thelib/src/protocols/rtp/rtspprotocol.cpp

    r41 r53  
    278278 
    279279InboundConnectivity *RTSPProtocol::GetInboundConnectivity(Variant &videoTrack, 
    280                 Variant &audioTrack) { 
     280                Variant &audioTrack, string sdpStreamName) { 
    281281        CloseInboundConnectivity(); 
     282        string streamName; 
     283        if (GetCustomParameters().HasKey("streamName")) { 
     284                streamName = (string) GetCustomParameters()["streamName"]; 
     285        } else { 
     286                streamName = sdpStreamName; 
     287        } 
    282288        _pInboundConnectivity = new InboundConnectivity(this); 
    283289        if (!_pInboundConnectivity->Initialize(videoTrack, audioTrack, 
    284                         (bool)GetCustomParameters()["forceTcp"])) { 
     290                        streamName, (bool)GetCustomParameters()["forceTcp"])) { 
    285291                FATAL("Unable to initialize inbound connectivity"); 
    286292                CloseInboundConnectivity(); 
  • trunk/sources/thelib/src/protocols/rtp/sdp.cpp

    r49 r53  
    11/*  
    2 *  Copyright (c) 2010, 
    3 *  Gavriloaie Eugen-Andrei (shiretu@gmail.com) 
    4  
    5 *  This file is part of crtmpserver. 
    6 *  crtmpserver is free software: you can redistribute it and/or modify 
    7 *  it under the terms of the GNU General Public License as published by 
    8 *  the Free Software Foundation, either version 3 of the License, or 
    9 *  (at your option) any later version. 
    10  
    11 *  crtmpserver is distributed in the hope that it will be useful, 
    12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    14 *  GNU General Public License for more details. 
    15  
    16 *  You should have received a copy of the GNU General Public License 
    17 *  along with crtmpserver.  If not, see <http://www.gnu.org/licenses/>. 
    18 */ 
     2 *  Copyright (c) 2010, 
     3 *  Gavriloaie Eugen-Andrei (shiretu@gmail.com) 
     4 * 
     5 *  This file is part of crtmpserver. 
     6 *  crtmpserver is free software: you can redistribute it and/or modify 
     7 *  it under the terms of the GNU General Public License as published by 
     8 *  the Free Software Foundation, either version 3 of the License, or 
     9 *  (at your option) any later version. 
     10 * 
     11 *  crtmpserver is distributed in the hope that it will be useful, 
     12 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
     13 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     14 *  GNU General Public License for more details. 
     15 * 
     16 *  You should have received a copy of the GNU General Public License 
     17 *  along with crtmpserver.  If not, see <http://www.gnu.org/licenses/>. 
     18 */ 
    1919 
    2020#ifdef HAS_PROTOCOL_RTP 
     
    127127        //3. Done 
    128128        return result; 
     129} 
     130 
     131string SDP::GetStreamName() { 
     132        if (!HasKey(SDP_SESSION)) 
     133                return ""; 
     134        if (!(*this)[SDP_SESSION].HasKey(SDP_S)) 
     135                return ""; 
     136        return (string) (*this)[SDP_SESSION][SDP_S]; 
    129137} 
    130138 
Note: See TracChangeset for help on using the changeset viewer.