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

List:       helix-server-cvs
Subject:    [Server-cvs]  engine/session client.cpp, 1.55, 1.56 clientsession.cpp,
From:       rexwangreal () helixcommunity ! org
Date:       2013-06-28 10:07:01
[Download RAW message or body]

Update of /cvsroot/server/engine/session
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv1420/server/engine/session


Modified Files:
	client.cpp clientsession.cpp 
Log Message:

Synopsis:
=================================================
Fix HLXSRV-402 that jwplayer playback always stutter while bandwidth change from low \
to high and videos in fregmented-mp4, and a bug in Dict::find()

Branch: SERVER_CURRENT_RN SERVER_15_1_0_RN

Suggested Reviewers: Anyone


Description:
=================================================
Bug HLXSRV-402:

Repro steps:
1. single bit-rate VODs created by Flash encoder: 248kbps, 548 kbps 1048kbps, key \
Frame interval 2s, place these vods on hms   these are f4v files in fregmented mp4 \
format. 2. configure JWplayer RTMP dynamic streaming for these vods
3. use netlimiter to change the bandwidth from low to high (200kbps 300 500 600 700 \
800 10001200    1500)

Actual:
  JW player playback stuttered when bandwidth is greater than 800kbps


It is slow to init a ClientSession for a fregmented mp4 file while the file is large.
So formerly startup of a play action triggered by a "play" command, or a switch \
action triggered by a "play2" command is slow. Thus after a swith action, jwplayer \
always consider the new level is bad for play, and then transfer to another level. \
That is the reason why playback stutter.


Now in this CR, only the first "play2" command for a file will cause init a \
ClientSession instance; later "play2" commands for this file will reuse the instance.


Files affected:
=================================================
server_rn/protocol/flash/rtmpserv/rtmpserv.cpp
server_rn/protocol/flash/rtmpserv/pub/rtmpserv.h
server/engine/session/client.cpp
server/engine/session/clientsession.cpp
server/engine/session/pub/clientsession.h
common/container/dict.cpp
common/container/pub/dict.h


Testing Performed:
===============
Centos 6.2 x64


QA Hints
========
N/A




Index: client.cpp
===================================================================
RCS file: /cvsroot/server/engine/session/client.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- client.cpp	4 Jun 2013 08:14:42 -0000	1.55
+++ client.cpp	28 Jun 2013 10:06:53 -0000	1.56
@@ -549,6 +549,21 @@
         pSession->Release();
     }
 
+    if (m_pSessions->GetCount() != 0)
+    {
+        m_pProc->pc->server_info->DecrementStreamCount(m_pProc);
+        if (m_pVhostInfo)
+        {
+            IHXBuffer* pVhostAccount = NULL;
+            m_pVhostInfo->GetPropertyBuffer("VhostAccount", pVhostAccount);
+            if (pVhostAccount)
+            {
+                m_pProc->pc->server_info->DecrementStreamCountVhost(m_pProc, (const \
char*)pVhostAccount->GetBuffer()); +            }
+            HX_RELEASE(pVhostAccount);
+        }
+    }
+
     m_pSessions->RemoveAll();
 }
 
@@ -586,18 +601,22 @@
             {
                 pos = m_pSessions->RemoveAt(pos);
                 pSession->Done(status);
-                m_pProc->pc->server_info->DecrementStreamCount(m_pProc);
-                if (m_pVhostInfo)
+                pSession->Release();
+
+                if (m_pSessions->GetCount() == 0)
                 {
-                    IHXBuffer* pVhostAccount = NULL;
-                    m_pVhostInfo->GetPropertyBuffer("VhostAccount", pVhostAccount);
-                    if (pVhostAccount)
+                    m_pProc->pc->server_info->DecrementStreamCount(m_pProc);
+                    if (m_pVhostInfo)
                     {
-                        m_pProc->pc->server_info->DecrementStreamCountVhost(m_pProc, \
(const char*)pVhostAccount->GetBuffer()); +                        IHXBuffer* \
pVhostAccount = NULL; +                        \
m_pVhostInfo->GetPropertyBuffer("VhostAccount", pVhostAccount); +                     \
if (pVhostAccount) +                        {
+                            \
m_pProc->pc->server_info->DecrementStreamCountVhost(m_pProc, (const \
char*)pVhostAccount->GetBuffer()); +                        }
+                        HX_RELEASE(pVhostAccount);
                     }
-                    HX_RELEASE(pVhostAccount);
                 }
-                pSession->Release();
             }
             else
             {
@@ -631,33 +650,7 @@
     CHXString sessionID;
     GenerateNewSessionID(sessionID, uSeqNo);
 
-    *ppSession = new ClientSession(m_pProc, this, sessionID);
-    m_pSessions->AddHead(*ppSession);
-
-    // AddRef for both list and out parameter.
-    (*ppSession)->AddRef();
-    (*ppSession)->AddRef();
-
-    /*
-    * this solves the problem of the subscriber counting http connections,
-    * which was solved previously by counting only pna and rtsp clients.
-    * since only pnaprot and rtspprot call NewSession() and/or
-    * NewSessioWithID() the subscriber can rely on the 'server.streamCount'
-    * var for the same info.
-    */
-    m_pProc->pc->server_info->IncrementStreamCount(m_pProc);
-    if (m_pVhostInfo)
-    {
-        IHXBuffer* pVhostAccount = NULL;
-        m_pVhostInfo->GetPropertyBuffer("VhostAccount", pVhostAccount);
-        if (pVhostAccount)
-        {
-            m_pProc->pc->server_info->IncrementStreamCountVhost(m_pProc, (const \
                char*)pVhostAccount->GetBuffer());
-        }
-        HX_RELEASE(pVhostAccount);
-    }
-
-    return HXR_OK;
+    return NewSessionWithID(ppSession, uSeqNo, sessionID, bRetainEntityForSetup);
 }
 
 HX_RESULT
@@ -672,23 +665,26 @@
     (*ppSession)->AddRef();
     (*ppSession)->AddRef();
 
-    /*
-    * this solves the problem of the subscriber counting http connections,
-    * which was solved previously by counting only pna and rtsp clients.
-    * since only pnaprot and rtspprot call NewSession() and/or
-    * NewSessioWithID() the subscriber can rely on the 'server.streamCount'
-    * var for the same info.
-    */
-    m_pProc->pc->server_info->IncrementStreamCount(m_pProc);
-    if (m_pVhostInfo)
+    if (m_pSessions->GetCount() == 1)
     {
-        IHXBuffer* pVhostAccount = NULL;
-        m_pVhostInfo->GetPropertyBuffer("VhostAccount", pVhostAccount);
-        if (pVhostAccount)
+        /*
+        * this solves the problem of the subscriber counting http connections,
+        * which was solved previously by counting only pna and rtsp clients.
+        * since only pnaprot and rtspprot call NewSession() and/or
+        * NewSessioWithID() the subscriber can rely on the 'server.streamCount'
+        * var for the same info.
+        */
+        m_pProc->pc->server_info->IncrementStreamCount(m_pProc);
+        if (m_pVhostInfo)
         {
-            m_pProc->pc->server_info->IncrementStreamCountVhost(m_pProc, (const \
char*)pVhostAccount->GetBuffer()); +            IHXBuffer* pVhostAccount = NULL;
+            m_pVhostInfo->GetPropertyBuffer("VhostAccount", pVhostAccount);
+            if (pVhostAccount)
+            {
+                m_pProc->pc->server_info->IncrementStreamCountVhost(m_pProc, (const \
char*)pVhostAccount->GetBuffer()); +            }
+            HX_RELEASE(pVhostAccount);
         }
-        HX_RELEASE(pVhostAccount);
     }
 
     return HXR_OK;

Index: clientsession.cpp
===================================================================
RCS file: /cvsroot/server/engine/session/clientsession.cpp,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -d -r1.210 -r1.211
--- clientsession.cpp	27 Jun 2013 02:45:07 -0000	1.210
+++ clientsession.cpp	28 Jun 2013 10:06:53 -0000	1.211
@@ -1149,8 +1149,6 @@
 {
     int i;
     HX_RESULT result = HXR_OK;
-    CHXSimpleList m_header_list;
-    CHXSimpleList m_need_release_headers;
 
     ASSERT(!m_is_ready);
 
@@ -1579,12 +1577,6 @@
     HX_RELEASE(m_pHeaderControlBuffer);
 
     result = m_pClient->GetProtocol()->setupStreams(&m_header_list, this, HXR_OK);
-    IHXValues* pReleaseValues;
-    while (!m_need_release_headers.IsEmpty())
-    {
-        pReleaseValues = (IHXValues*)m_need_release_headers.RemoveHead();
-        pReleaseValues->Release();
-    }
 
     if (SUCCEEDED(result))
     {
@@ -5910,6 +5902,15 @@
     }
     HX_RELEASE(m_pPlaylistRequest);
 #endif // HELIX_FEATURE_SERVER_SSPL
+
+    // cleanup m_need_release_headers, see StreamHeadersReady for more
+    IHXValues* pReleaseValues;
+    while (!m_need_release_headers.IsEmpty())
+    {
+        pReleaseValues = (IHXValues*)m_need_release_headers.RemoveHead();
+        pReleaseValues->Release();
+    }
+    m_header_list.RemoveAll();
 }
 
 /* IHXClientBandwidthController Methods */


_______________________________________________
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