[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] protocol/rtsp crtspbase.cpp,1.74.4.9,1.74.4.9.4.1
From:       jzeng () helixcommunity ! org
Date:       2010-10-22 22:23:04
Message-ID: 201010222223.o9MMN9vg021283 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/server/protocol/rtsp
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv5163/server/protocol/rtsp

Modified Files:
      Tag: SERVER_14_0_MT_BETA
	crtspbase.cpp 
Log Message:
Synopsis
============
multiplexer cient url handling
Branches:  head, SERVER_14_0_MT_BETA
Suggested Reviewer:  Chytanya 

Description
===========
This is to implement url params with vid and aud track names, as well as bitrate selection.

Please refer to the spec for more details.


Files Affected
============== 

modified files:
server/protocol/rtsp/crtspbase.cpp,v
server/protocol/rtsp/pub/crtspbase.h,v
server/protocol/common/Umakefil,v
server_rn/protocol/flash/rtmpserv/rtmpserv.cpp,v

new files:
server/protocol/common/mp_url_parser.cpp
server/protocol/common/pub/mp_url_parser.h

Testing Performed
================= 

Unit Tests: 
None. 

Integration Tests: 
Test both live and on-demand, rtmp and rtsp, with various url parameters.


Leak Tests: 
None. 

Performance Tests: 
- None 

Platforms Tested: win32-i386-vc7
Build verified: win32-i386-vc7 






Index: crtspbase.cpp
===================================================================
RCS file: /cvsroot/server/protocol/rtsp/crtspbase.cpp,v
retrieving revision 1.74.4.9
retrieving revision 1.74.4.9.4.1
diff -u -d -r1.74.4.9 -r1.74.4.9.4.1
--- crtspbase.cpp	3 Aug 2010 22:41:38 -0000	1.74.4.9
+++ crtspbase.cpp	22 Oct 2010 22:23:01 -0000	1.74.4.9.4.1
@@ -103,6 +103,8 @@
 #include "urlparser.h"
 #include "header_helper.h"
 #include "server_info.h"
+#include "mp_url_parser.h"
+
 
 // the key for the config property in the config file
 static const char* CONFIG_ROOT_KEY = "config";
@@ -7806,7 +7808,7 @@
  *
  * \return void
  */
-    void
+ HX_RESULT
 CRTSPBaseProtocol::_FinishDescribe(const char* pcSessionID,
         HXBOOL bUseOldSdp,
         IHXValues* pFileHeader,
@@ -7818,6 +7820,7 @@
     IHXStreamDescription* pSD = NULL;
     CHXSimpleList::Iterator i;
     UINT16 nStreams = pHeaders->GetCount();
+    HX_RESULT retVal = HXR_OK;
 
     RTSPServerSession* pSession = GetSession(pcSessionID);
     pSession->m_uStreamCount = nStreams;
@@ -8353,12 +8356,85 @@
         }
 
         pSession->SetSDPSessionGUID(pSD, ppValues);
+
+        CMultiplexerURLParser* pMPParser = new CMultiplexerURLParser(m_proc->pc->server_context);
+        if(pMPParser->IsMultiplexerEnabled())
+        {
+            const char* pDecUrl = NULL;
+            if(m_pUrl)
+            {
+                m_pUrl->GetDecodedUrl(pDecUrl);
+                if(pDecUrl)
+                {
+                    pMPParser->SetURL(pDecUrl);
+                }
+                else
+                {
+                    HX_DELETE(pMPParser);
+                }
+            }
+            else
+            {
+                HX_DELETE(pMPParser);
+            }
+        }
+        else
+        {
+            HX_DELETE(pMPParser);
+        }
+
+        if(pMPParser && pMPParser->IsMultiplexerRequest())
+        {
+            CHXSimpleList selectedList;
+            pMPParser->GetMultiplexerStreamHeader(pHeaders, &selectedList);
+            if(selectedList.GetCount() == 0)
+            {
+                retVal = HXR_FILE_NOT_FOUND;
+            }
+            else
+            {
+                UINT32 nOriginalStreamGroupCount = 0;
+                UINT32 nOriginalStreamCount = 0;
+                j = 2;
+                for (i = selectedList.Begin(); i != selectedList.End(); ++i)
+                {
+                    ppValues[j] = (IHXValues*)(*i);
+                    j++;
+                }
+                nStreams = selectedList.GetCount();
+
+                m_pFileHeader->GetPropertyULONG32("StreamGroupCount", nOriginalStreamGroupCount);
+                m_pFileHeader->GetPropertyULONG32("StreamCount", nOriginalStreamCount);
+                
+                IHXValues2* pV2 = NULL;
+                m_pFileHeader->QueryInterface(IID_IHXValues2, (void**)&pV2);
+                if(pV2)
+                {
+                    pV2->RemoveULONG32("StreamGroupCount");
+                    pV2->Release();
+                }
+                m_pFileHeader->SetPropertyULONG32("StreamCount", nStreams);
+
+                pSD->GetDescription(nStreams+2, ppValues, (*ppIHXBufferDescription));
+
+                if(nOriginalStreamGroupCount > 0)
+                    m_pFileHeader->SetPropertyULONG32("StreamGroupCount", nOriginalStreamGroupCount);
+                if(nOriginalStreamCount > 0)
+                    m_pFileHeader->SetPropertyULONG32("StreamCount", nOriginalStreamCount);
+            }
+        }
+        else
+        {
         pSD->GetDescription(nStreams+2, ppValues, (*ppIHXBufferDescription));
+        }
+
         HX_RELEASE(pSD);
         HX_RELEASE(pRulesBuf);
+        HX_DELETE(pMPParser);
 
         delete[] ppValues;
     }
+    return retVal;
 }
 
 /**
@@ -13780,52 +13856,62 @@
         IHXBuffer* pBufDesc = NULL;
         CHXString mimeType;
 
-        _FinishDescribe(pSessionID, pSession->m_bUseOldSdp, pFileHeader,
+        rc = _FinishDescribe(pSessionID, pSession->m_bUseOldSdp, pFileHeader,
                 pStreams, pOptionalValues, mimeType, &pBufDesc);
 
-        // if the DESCRIBE request had an "Aggregate-Transport" header
-        // we need to select a transport now - and to add the
-        // "Aggregate-Transport" header to the response if successful
-        if (pSession->m_bNeedAggregateTransportHeader)
+        if(FAILED(rc))
         {
-            rc = pSession->m_pTransportInstantiator->selectTransport(pSession);
-            if (SUCCEEDED(rc))
-            {
-                IHXMIMEHeader* pHeader;
-
-                pHeader = pSession->m_pTransportInstantiator->MakeTransportHeader(TRUE);
-                m_pRespMsg->AddHeader(pHeader);
-            }
+            //XXXJJ only in multiplexer case with streamname not found
+            SendResponse(404);
+            SetStatus(pSession->m_ulSessionRegistryNumber,
+                    pSession->m_ulSessionStatsObjId,
+                    404);
         }
-
-        if (SUCCEEDED(rc))
+        else
         {
-            pSession->m_bSessionSetup = TRUE;
+            // if the DESCRIBE request had an "Aggregate-Transport" header
+            // we need to select a transport now - and to add the
+            // "Aggregate-Transport" header to the response if successful
+            if (pSession->m_bNeedAggregateTransportHeader)
+            {
+                rc = pSession->m_pTransportInstantiator->selectTransport(pSession);
+                if (SUCCEEDED(rc))
+                {
+                    IHXMIMEHeader* pHeader;
 
-            /** The SDP is added as an entity body with related headers */
-            rc = AddEntityHeaders(pSession, mimeType, pBufDesc,
-                    pValidResponseHeaders);
+                    pHeader = pSession->m_pTransportInstantiator->MakeTransportHeader(TRUE);
+                    m_pRespMsg->AddHeader(pHeader);
+                }
+            }
 
             if (SUCCEEDED(rc))
             {
-                SendResponse(200);
+                pSession->m_bSessionSetup = TRUE;
+
+                /** The SDP is added as an entity body with related headers */
+                rc = AddEntityHeaders(pSession, mimeType, pBufDesc,
+                        pValidResponseHeaders);
+
+                if (SUCCEEDED(rc))
+                {
+                    SendResponse(200);
+                }
+                else
+                {
+                    SendResponse(500);
+                }
             }
             else
             {
-                SendResponse(500);
+                /** We get here if selectTransport fails - "461 Unsupported
+                 * Transport" is the most suitable catchall error code
+                 * although you could make a case for checking the rc and
+                 * returning a 500 for a few cases. */
+                SendResponse(461);
+                SetStatus(pSession->m_ulSessionRegistryNumber,
+                        pSession->m_ulSessionStatsObjId, 461);
             }
         }
-        else
-        {
-            /** We get here if selectTransport fails - "461 Unsupported
-             * Transport" is the most suitable catchall error code
-             * although you could make a case for checking the rc and
-             * returning a 500 for a few cases. */
-            SendResponse(461);
-            SetStatus(pSession->m_ulSessionRegistryNumber,
-                    pSession->m_ulSessionStatsObjId, 461);
-        }
-
         HX_RELEASE(pBufDesc);
     }
     else
@@ -13952,12 +14038,12 @@
             HX_RELEASE(pBufNeedSDP);
         }
 
-        _FinishDescribe(pSession->m_sessionID, pSession->m_bUseOldSdp,
+        rc = _FinishDescribe(pSession->m_sessionID, pSession->m_bUseOldSdp,
                 pFileHeader, pStreams, pOptionalValues, mimeType,
                 &pBufDesc);
 
         /** The SDP is added as an entity body with related headers */
-        if (bNeedSDP)
+        if (SUCCEEDED(rc) && bNeedSDP)
         {
             rc = AddEntityHeaders(pSession, mimeType, pBufDesc, pValidResponseHeaders);
         }


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic