From gwright at real.com Wed Oct 1 18:40:35 2003
From: gwright at real.com (Greg Wright)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] Cr for servertimeout crash
Message-ID: <000f01c38886$2d0e6860$7c6f17ac@gwright3>
This patch fixes a crash when you unplug the network cable while
playing back content. GetHead is not valid if the list is empty.
This CR would go into HEAD, KittyHawk and Neptune (after approval).
--greg.
Index: rtspclnt.cpp
===================================================================
RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
retrieving revision 1.6.2.10
diff -u -w -r1.6.2.10 rtspclnt.cpp
--- rtspclnt.cpp 22 Aug 2003 16:54:34 -0000 1.6.2.10
+++ rtspclnt.cpp 2 Oct 2003 01:37:29 -0000
@@ -6010,6 +6010,8 @@
m_bFastStart = FALSE;
+ if( !m_transportRequestList.IsEmpty() )
+ {
pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
pTransInfo = pRequest->getFirstTransportInfo();
while(pTransInfo)
@@ -6017,7 +6019,7 @@
pTransInfo->m_pTransport->LeaveFastStart();
pTransInfo = pRequest->getNextTransportInfo();
}
-
+ }
return;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From acolwell at real.com Wed Oct 1 20:09:10 2003
From: acolwell at real.com (Aaron Colwell)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] Cr for servertimeout crash
In-Reply-To: <000f01c38886$2d0e6860$7c6f17ac@gwright3>
Message-ID:
Looks good to me.
Aaron
On Wed, 1 Oct 2003, Greg Wright wrote:
> This patch fixes a crash when you unplug the network cable while
> playing back content. GetHead is not valid if the list is empty.
>
> This CR would go into HEAD, KittyHawk and Neptune (after approval).
>
> --greg.
>
>
>
> Index: rtspclnt.cpp
> ===================================================================
> RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
> retrieving revision 1.6.2.10
> diff -u -w -r1.6.2.10 rtspclnt.cpp
> --- rtspclnt.cpp 22 Aug 2003 16:54:34 -0000 1.6.2.10
> +++ rtspclnt.cpp 2 Oct 2003 01:37:29 -0000
> @@ -6010,6 +6010,8 @@
>
> m_bFastStart = FALSE;
>
> + if( !m_transportRequestList.IsEmpty() )
> + {
> pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
> pTransInfo = pRequest->getFirstTransportInfo();
> while(pTransInfo)
> @@ -6017,7 +6019,7 @@
> pTransInfo->m_pTransport->LeaveFastStart();
> pTransInfo = pRequest->getNextTransportInfo();
> }
> -
> + }
> return;
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
> For additional commands, e-mail: dev-help@protocol.helixcommunity.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From ping at real.com Wed Oct 1 21:43:03 2003
From: ping at real.com (Henry Ping)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] Re: Cr for servertimeout crash
In-Reply-To: <000f01c38886$2d0e6860$7c6f17ac@gwright3>
Message-ID: <5.1.0.14.2.20031001213234.044073c0@mailone.real.com>
Is this crash across platforms? This code has been there since R1, I am
curious why we didn't catch this during the reconnect test in released player.
We need to apply this to several other places in the same file where we
don't check m_transportRequestList.IsEmpty() before accessing the list.
-->Henry
At 06:40 PM 10/1/2003 -0700, Greg Wright wrote:
>This patch fixes a crash when you unplug the network cable while
>playing back content. GetHead is not valid if the list is empty.
>
>This CR would go into HEAD, KittyHawk and Neptune (after approval).
>
>--greg.
>
>
>
>Index: rtspclnt.cpp
>===================================================================
>RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
>retrieving revision 1.6.2.10
>diff -u -w -r1.6.2.10 rtspclnt.cpp
>--- rtspclnt.cpp 22 Aug 2003 16:54:34 -0000 1.6.2.10
>+++ rtspclnt.cpp 2 Oct 2003 01:37:29 -0000
>@@ -6010,6 +6010,8 @@
>
> m_bFastStart = FALSE;
>
>+ if( !m_transportRequestList.IsEmpty() )
>+ {
> pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
> pTransInfo = pRequest->getFirstTransportInfo();
> while(pTransInfo)
>@@ -6017,7 +6019,7 @@
> pTransInfo->m_pTransport->LeaveFastStart();
> pTransInfo = pRequest->getNextTransportInfo();
> }
>-
>+ }
> return;
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From gwright at real.com Thu Oct 2 08:48:30 2003
From: gwright at real.com (Greg Wright)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] Re: Cr for servertimeout crash
References: <5.1.0.14.2.20031001213234.044073c0@mailone.real.com>
Message-ID: <007401c388fc$a12db810$7c6f17ac@gwright3>
> Is this crash across platforms? This code has been there since R1, I am
> curious why we didn't catch this during the reconnect test in released player.
We are using splay to repro, which acts differently then other players.
Also, QA has mentioned that you must set ServerTimeout to 10, down from
30 or 60, in order to repro.
>
> We need to apply this to several other places in the same file where we
> don't check m_transportRequestList.IsEmpty() before accessing the list.
I will look into it. However, I am a little hesitant to make
large changes in the stable branches unless I am fixing a problem.
It is harder to do a complete test. Let me see what the final changes
look like.
--greg.
>
> -->Henry
>
> At 06:40 PM 10/1/2003 -0700, Greg Wright wrote:
> >This patch fixes a crash when you unplug the network cable while
> >playing back content. GetHead is not valid if the list is empty.
> >
> >This CR would go into HEAD, KittyHawk and Neptune (after approval).
> >
> >--greg.
> >
> >
> >
> >Index: rtspclnt.cpp
> >===================================================================
> >RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
> >retrieving revision 1.6.2.10
> >diff -u -w -r1.6.2.10 rtspclnt.cpp
> >--- rtspclnt.cpp 22 Aug 2003 16:54:34 -0000 1.6.2.10
> >+++ rtspclnt.cpp 2 Oct 2003 01:37:29 -0000
> >@@ -6010,6 +6010,8 @@
> >
> > m_bFastStart = FALSE;
> >
> >+ if( !m_transportRequestList.IsEmpty() )
> >+ {
> > pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
> > pTransInfo = pRequest->getFirstTransportInfo();
> > while(pTransInfo)
> >@@ -6017,7 +6019,7 @@
> > pTransInfo->m_pTransport->LeaveFastStart();
> > pTransInfo = pRequest->getNextTransportInfo();
> > }
> >-
> >+ }
> > return;
> > }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From gwright at real.com Thu Oct 2 09:06:49 2003
From: gwright at real.com (Greg Wright)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] Re: Cr for servertimeout crash
References: <5.1.0.14.2.20031001213234.044073c0@mailone.real.com> <007401c388fc$a12db810$7c6f17ac@gwright3>
Message-ID: <00d601c388ff$3331b700$7c6f17ac@gwright3>
New diff for HEAD at least, kittyhawk and neptune as star-chambered.
--greg.
Index: rtspclnt.cpp
===================================================================
RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
retrieving revision 1.6.2.10
diff -u -w -r1.6.2.10 rtspclnt.cpp
--- rtspclnt.cpp 22 Aug 2003 16:54:34 -0000 1.6.2.10
+++ rtspclnt.cpp 2 Oct 2003 16:04:35 -0000
@@ -1384,9 +1384,7 @@
RTSPStreamInfo* pStreamInfo = (RTSPStreamInfo*)m_streamInfoList.GetHead();
if(pStreamInfo)
{
- return sendSetupRequestMessage
- (
- pStreamInfo,
+ return sendSetupRequestMessage( pStreamInfo,
pIHXValuesRequestHeaders,
TRUE
);
@@ -1799,6 +1797,8 @@
// only used when m_bNonRSRTP is TRUE
m_bPlayJustSent = FALSE;
+ if( !m_transportRequestList.IsEmpty() )
+ {
RTSPTransportRequest* pRequest =
(RTSPTransportRequest*)m_transportRequestList.GetHead();
RTSPTransportInfo* pTransInfo = pRequest->getFirstTransportInfo();
@@ -1807,6 +1807,7 @@
pTransInfo->m_pTransport->pauseBuffers();
pTransInfo = pRequest->getNextTransportInfo();
}
+ }
RTSPPauseMessage* pMsg = new RTSPPauseMessage;
pMsg->setURL(m_url);
@@ -1817,6 +1818,7 @@
UINT32 seqNo = m_pSession->getNextSeqNo(this);
HX_RESULT rc = sendRequest(pMsg, seqNo);
+
m_pMutex->Unlock();
return rc;
}
@@ -1830,6 +1832,8 @@
m_pMutex->Lock();
+ if( !m_transportRequestList.IsEmpty() )
+ {
RTSPTransportRequest* pRequest =
(RTSPTransportRequest*)m_transportRequestList.GetHead();
RTSPTransportInfo* pTransInfo = pRequest->getFirstTransportInfo();
@@ -1838,6 +1842,7 @@
pTransInfo->m_pTransport->resumeBuffers();
pTransInfo = pRequest->getNextTransportInfo();
}
+ }
/*
* Man, iptv, teracast, and darwin server don't like this even though
@@ -5972,6 +5977,8 @@
m_bPrefetch = FALSE;
+ if( !m_transportRequestList.IsEmpty())
+ {
pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
pTransInfo = pRequest->getFirstTransportInfo();
while(pTransInfo)
@@ -5979,6 +5986,7 @@
pTransInfo->m_pTransport->LeavePrefetch();
pTransInfo = pRequest->getNextTransportInfo();
}
+ }
return;
}
@@ -5991,6 +5999,8 @@
m_bFastStart = TRUE;
+ if( !m_transportRequestList.IsEmpty() )
+ {
pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
pTransInfo = pRequest->getFirstTransportInfo();
while(pTransInfo)
@@ -5998,6 +6008,8 @@
pTransInfo->m_pTransport->EnterFastStart();
pTransInfo = pRequest->getNextTransportInfo();
}
+ }
+
return;
}
@@ -6010,6 +6022,8 @@
m_bFastStart = FALSE;
+ if( !m_transportRequestList.IsEmpty() )
+ {
pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
pTransInfo = pRequest->getFirstTransportInfo();
while(pTransInfo)
@@ -6017,7 +6031,7 @@
pTransInfo->m_pTransport->LeaveFastStart();
pTransInfo = pRequest->getNextTransportInfo();
}
-
+ }
return;
}
----- Original Message -----
From: "Greg Wright"
To: ; "Henry Ping"
Sent: Thursday, October 02, 2003 8:48 AM
Subject: [hxprotocol] Re: Cr for servertimeout crash
>
> > Is this crash across platforms? This code has been there since R1, I am
> > curious why we didn't catch this during the reconnect test in released player.
>
> We are using splay to repro, which acts differently then other players.
> Also, QA has mentioned that you must set ServerTimeout to 10, down from
> 30 or 60, in order to repro.
>
> >
> > We need to apply this to several other places in the same file where we
> > don't check m_transportRequestList.IsEmpty() before accessing the list.
>
> I will look into it. However, I am a little hesitant to make
> large changes in the stable branches unless I am fixing a problem.
> It is harder to do a complete test. Let me see what the final changes
> look like.
>
> --greg.
>
>
> >
> > -->Henry
> >
> > At 06:40 PM 10/1/2003 -0700, Greg Wright wrote:
> > >This patch fixes a crash when you unplug the network cable while
> > >playing back content. GetHead is not valid if the list is empty.
> > >
> > >This CR would go into HEAD, KittyHawk and Neptune (after approval).
> > >
> > >--greg.
> > >
> > >
> > >
> > >Index: rtspclnt.cpp
> > >===================================================================
> > >RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
> > >retrieving revision 1.6.2.10
> > >diff -u -w -r1.6.2.10 rtspclnt.cpp
> > >--- rtspclnt.cpp 22 Aug 2003 16:54:34 -0000 1.6.2.10
> > >+++ rtspclnt.cpp 2 Oct 2003 01:37:29 -0000
> > >@@ -6010,6 +6010,8 @@
> > >
> > > m_bFastStart = FALSE;
> > >
> > >+ if( !m_transportRequestList.IsEmpty() )
> > >+ {
> > > pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
> > > pTransInfo = pRequest->getFirstTransportInfo();
> > > while(pTransInfo)
> > >@@ -6017,7 +6019,7 @@
> > > pTransInfo->m_pTransport->LeaveFastStart();
> > > pTransInfo = pRequest->getNextTransportInfo();
> > > }
> > >-
> > >+ }
> > > return;
> > > }
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
> For additional commands, e-mail: dev-help@protocol.helixcommunity.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From ehyche at real.com Thu Oct 2 09:09:49 2003
From: ehyche at real.com (Eric Hyche)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] Re: Cr for servertimeout crash
In-Reply-To: <00d601c388ff$3331b700$7c6f17ac@gwright3>
References: <5.1.0.14.2.20031001213234.044073c0@mailone.real.com>
<007401c388fc$a12db810$7c6f17ac@gwright3>
Message-ID: <5.1.0.14.2.20031002120919.02b34ab0@mailone.real.com>
Looks good.
Eric
At 09:06 AM 10/2/2003 -0700, Greg Wright wrote:
>New diff for HEAD at least, kittyhawk and neptune as star-chambered.
>
>--greg.
>
>
>Index: rtspclnt.cpp
>===================================================================
>RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
>retrieving revision 1.6.2.10
>diff -u -w -r1.6.2.10 rtspclnt.cpp
>--- rtspclnt.cpp 22 Aug 2003 16:54:34 -0000 1.6.2.10
>+++ rtspclnt.cpp 2 Oct 2003 16:04:35 -0000
>@@ -1384,9 +1384,7 @@
> RTSPStreamInfo* pStreamInfo = (RTSPStreamInfo*)m_streamInfoList.GetHead();
> if(pStreamInfo)
> {
>- return sendSetupRequestMessage
>- (
>- pStreamInfo,
>+ return sendSetupRequestMessage( pStreamInfo,
> pIHXValuesRequestHeaders,
> TRUE
> );
>@@ -1799,6 +1797,8 @@
> // only used when m_bNonRSRTP is TRUE
> m_bPlayJustSent = FALSE;
>
>+ if( !m_transportRequestList.IsEmpty() )
>+ {
> RTSPTransportRequest* pRequest =
> (RTSPTransportRequest*)m_transportRequestList.GetHead();
> RTSPTransportInfo* pTransInfo = pRequest->getFirstTransportInfo();
>@@ -1807,6 +1807,7 @@
> pTransInfo->m_pTransport->pauseBuffers();
> pTransInfo = pRequest->getNextTransportInfo();
> }
>+ }
>
> RTSPPauseMessage* pMsg = new RTSPPauseMessage;
> pMsg->setURL(m_url);
>@@ -1817,6 +1818,7 @@
> UINT32 seqNo = m_pSession->getNextSeqNo(this);
>
> HX_RESULT rc = sendRequest(pMsg, seqNo);
>+
> m_pMutex->Unlock();
> return rc;
> }
>@@ -1830,6 +1832,8 @@
>
> m_pMutex->Lock();
>
>+ if( !m_transportRequestList.IsEmpty() )
>+ {
> RTSPTransportRequest* pRequest =
> (RTSPTransportRequest*)m_transportRequestList.GetHead();
> RTSPTransportInfo* pTransInfo = pRequest->getFirstTransportInfo();
>@@ -1838,6 +1842,7 @@
> pTransInfo->m_pTransport->resumeBuffers();
> pTransInfo = pRequest->getNextTransportInfo();
> }
>+ }
>
> /*
> * Man, iptv, teracast, and darwin server don't like this even though
>@@ -5972,6 +5977,8 @@
>
> m_bPrefetch = FALSE;
>
>+ if( !m_transportRequestList.IsEmpty())
>+ {
> pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
> pTransInfo = pRequest->getFirstTransportInfo();
> while(pTransInfo)
>@@ -5979,6 +5986,7 @@
> pTransInfo->m_pTransport->LeavePrefetch();
> pTransInfo = pRequest->getNextTransportInfo();
> }
>+ }
>
> return;
> }
>@@ -5991,6 +5999,8 @@
>
> m_bFastStart = TRUE;
>
>+ if( !m_transportRequestList.IsEmpty() )
>+ {
> pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
> pTransInfo = pRequest->getFirstTransportInfo();
> while(pTransInfo)
>@@ -5998,6 +6008,8 @@
> pTransInfo->m_pTransport->EnterFastStart();
> pTransInfo = pRequest->getNextTransportInfo();
> }
>+ }
>+
>
> return;
> }
>@@ -6010,6 +6022,8 @@
>
> m_bFastStart = FALSE;
>
>+ if( !m_transportRequestList.IsEmpty() )
>+ {
> pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
> pTransInfo = pRequest->getFirstTransportInfo();
> while(pTransInfo)
>@@ -6017,7 +6031,7 @@
> pTransInfo->m_pTransport->LeaveFastStart();
> pTransInfo = pRequest->getNextTransportInfo();
> }
>-
>+ }
> return;
> }
>
>
>
>
>
>
>
>----- Original Message -----
>From: "Greg Wright"
>To: ; "Henry Ping"
>Sent: Thursday, October 02, 2003 8:48 AM
>Subject: [hxprotocol] Re: Cr for servertimeout crash
>
>
> >
> > > Is this crash across platforms? This code has been there since R1, I am
> > > curious why we didn't catch this during the reconnect test in
> released player.
> >
> > We are using splay to repro, which acts differently then other players.
> > Also, QA has mentioned that you must set ServerTimeout to 10, down from
> > 30 or 60, in order to repro.
> >
> > >
> > > We need to apply this to several other places in the same file where we
> > > don't check m_transportRequestList.IsEmpty() before accessing the list.
> >
> > I will look into it. However, I am a little hesitant to make
> > large changes in the stable branches unless I am fixing a problem.
> > It is harder to do a complete test. Let me see what the final changes
> > look like.
> >
> > --greg.
> >
> >
> > >
> > > -->Henry
> > >
> > > At 06:40 PM 10/1/2003 -0700, Greg Wright wrote:
> > > >This patch fixes a crash when you unplug the network cable while
> > > >playing back content. GetHead is not valid if the list is empty.
> > > >
> > > >This CR would go into HEAD, KittyHawk and Neptune (after approval).
> > > >
> > > >--greg.
> > > >
> > > >
> > > >
> > > >Index: rtspclnt.cpp
> > > >===================================================================
> > > >RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
> > > >retrieving revision 1.6.2.10
> > > >diff -u -w -r1.6.2.10 rtspclnt.cpp
> > > >--- rtspclnt.cpp 22 Aug 2003 16:54:34 -0000 1.6.2.10
> > > >+++ rtspclnt.cpp 2 Oct 2003 01:37:29 -0000
> > > >@@ -6010,6 +6010,8 @@
> > > >
> > > > m_bFastStart = FALSE;
> > > >
> > > >+ if( !m_transportRequestList.IsEmpty() )
> > > >+ {
> > > > pRequest =
> (RTSPTransportRequest*)m_transportRequestList.GetHead();
> > > > pTransInfo = pRequest->getFirstTransportInfo();
> > > > while(pTransInfo)
> > > >@@ -6017,7 +6019,7 @@
> > > > pTransInfo->m_pTransport->LeaveFastStart();
> > > > pTransInfo = pRequest->getNextTransportInfo();
> > > > }
> > > >-
> > > >+ }
> > > > return;
> > > > }
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
> > For additional commands, e-mail: dev-help@protocol.helixcommunity.org
> >
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
>For additional commands, e-mail: dev-help@protocol.helixcommunity.org
======================================
M. Eric Hyche (ehyche@real.com)
Core Technologies
RealNetworks, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From gwright at real.com Thu Oct 2 14:56:44 2003
From: gwright at real.com (Greg Wright)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CN-Client: Fix for RTSP crash.
Message-ID: <027601c38930$12992dd0$7c6f17ac@gwright3>
Changes commited to all branches below.
--greg.
-------------------
CN-Client: Fix for RTSP crash.
Modified by: gwright
Reviewed by: assorted (ping, etc)
Date: 02Oct03
Project:
Synopsis: Pulling the network cable crashes client.
Overview: If you set the servertimeout pref to '10', stream some
audio clips and then pull the network cable, the client
will crash after about 1-2 minutes.
Files Modified: protocol/rtsp/rtspclnt.cpp
Image Size and Heap Use impact:
few new bytes in image.
Platforms and Profiles Affected:
all
Distribution Libraries affected:
none
Distribution library impact and planned action:
none
Platforms and Profiles Build Verified:
linux all-defines.
Platforms and Profiles Functionality verified:
linux all-defines.
Branch:
HEAD, NEPTUNE, KITTYHAWK.
QA Instructions:
Try to repro the crash, it should not.
Try normal playback with pause/resume/stop-play.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From acolwell at real.com Thu Oct 2 15:21:46 2003
From: acolwell at real.com (Aaron Colwell)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CR-Client: Fix rtsp memory leak
Message-ID:
Synopsis: Fix memory leak caused by classes derived from RTSPClientSession
Overview: RTSPClientSession is used as a base class. Derived classes
are usually deleted via a pointer to RTSPClientSession. This
means that RTSPClientSession needs to have a virtual destructor
so that any allocations in the derived class can be cleaned up.
Files Modified:
protocol/rtsp/pub/rtspclnt.h
Files Added: none
Image Size and Heap Use impact: tiny
Platforms and Profiles affected: all
Distribution Libraries affected: rdtclntlib.lib
Distribution library impact and planned action:
Making the destructor virtual basically changes the layout of the class.
The rdtclntlib library contains a class that derives from
RTSPClientSession.
Platforms and Profiles Build Verified: symbian-61-emulator
Platforms and Profiles Functionality verified: symbian-61-emulator
Branch: HEAD, neptune
QA Instructions: none
Index: rtsp/pub/rtspclnt.h
===================================================================
RCS file: /cvs/protocol/rtsp/pub/rtspclnt.h,v
retrieving revision 1.11
diff -u -r1.11 rtspclnt.h
--- rtsp/pub/rtspclnt.h 24 Sep 2003 18:52:06 -0000 1.11
+++ rtsp/pub/rtspclnt.h 2 Oct 2003 21:34:44 -0000
@@ -161,7 +161,7 @@
{
public:
RTSPClientSession ();
- ~RTSPClientSession ();
+ virtual ~RTSPClientSession ();
HX_RESULT Done ();
HX_RESULT Init (IUnknown* pContext,
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From ping at real.com Thu Oct 2 15:26:50 2003
From: ping at real.com (Henry Ping)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CR-Client: Fix rtsp memory leak
In-Reply-To:
Message-ID: <5.1.0.14.2.20031002152608.03e82f20@mailone.real.com>
nice catch! looks good
-->Henry
At 03:21 PM 10/2/2003 -0700, Aaron Colwell wrote:
>Synopsis: Fix memory leak caused by classes derived from RTSPClientSession
>
>Overview: RTSPClientSession is used as a base class. Derived classes
> are usually deleted via a pointer to RTSPClientSession. This
> means that RTSPClientSession needs to have a virtual destructor
> so that any allocations in the derived class can be cleaned up.
>
>Files Modified:
>protocol/rtsp/pub/rtspclnt.h
>
>Files Added: none
>
>Image Size and Heap Use impact: tiny
>
>Platforms and Profiles affected: all
>
>Distribution Libraries affected: rdtclntlib.lib
>
>Distribution library impact and planned action:
>Making the destructor virtual basically changes the layout of the class.
>The rdtclntlib library contains a class that derives from
>RTSPClientSession.
>
>Platforms and Profiles Build Verified: symbian-61-emulator
>
>Platforms and Profiles Functionality verified: symbian-61-emulator
>
>Branch: HEAD, neptune
>
>QA Instructions: none
>
>Index: rtsp/pub/rtspclnt.h
>===================================================================
>RCS file: /cvs/protocol/rtsp/pub/rtspclnt.h,v
>retrieving revision 1.11
>diff -u -r1.11 rtspclnt.h
>--- rtsp/pub/rtspclnt.h 24 Sep 2003 18:52:06 -0000 1.11
>+++ rtsp/pub/rtspclnt.h 2 Oct 2003 21:34:44 -0000
>@@ -161,7 +161,7 @@
> {
> public:
> RTSPClientSession ();
>- ~RTSPClientSession ();
>+ virtual ~RTSPClientSession ();
>
> HX_RESULT Done ();
> HX_RESULT Init (IUnknown* pContext,
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
>For additional commands, e-mail: dev-help@protocol.helixcommunity.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From acolwell at real.com Thu Oct 2 15:43:08 2003
From: acolwell at real.com (Aaron Colwell)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CN-Client: Fix rtsp memory leak
In-Reply-To: <5.1.0.14.2.20031002152608.03e82f20@mailone.real.com>
Message-ID:
checked in
Modified by: acolwell@real.com
Reviewed by: ping@real.com
Date: 10:02:03
Project: VFR2
On Thu, 2 Oct 2003, Henry Ping wrote:
> nice catch! looks good
>
> -->Henry
>
> At 03:21 PM 10/2/2003 -0700, Aaron Colwell wrote:
>
> >Synopsis: Fix memory leak caused by classes derived from RTSPClientSession
> >
> >Overview: RTSPClientSession is used as a base class. Derived classes
> > are usually deleted via a pointer to RTSPClientSession. This
> > means that RTSPClientSession needs to have a virtual destructor
> > so that any allocations in the derived class can be cleaned up.
> >
> >Files Modified:
> >protocol/rtsp/pub/rtspclnt.h
> >
> >Files Added: none
> >
> >Image Size and Heap Use impact: tiny
> >
> >Platforms and Profiles affected: all
> >
> >Distribution Libraries affected: rdtclntlib.lib
> >
> >Distribution library impact and planned action:
> >Making the destructor virtual basically changes the layout of the class.
> >The rdtclntlib library contains a class that derives from
> >RTSPClientSession.
> >
> >Platforms and Profiles Build Verified: symbian-61-emulator
> >
> >Platforms and Profiles Functionality verified: symbian-61-emulator
> >
> >Branch: HEAD, neptune
> >
> >QA Instructions: none
> >
> >Index: rtsp/pub/rtspclnt.h
> >===================================================================
> >RCS file: /cvs/protocol/rtsp/pub/rtspclnt.h,v
> >retrieving revision 1.11
> >diff -u -r1.11 rtspclnt.h
> >--- rtsp/pub/rtspclnt.h 24 Sep 2003 18:52:06 -0000 1.11
> >+++ rtsp/pub/rtspclnt.h 2 Oct 2003 21:34:44 -0000
> >@@ -161,7 +161,7 @@
> > {
> > public:
> > RTSPClientSession ();
> >- ~RTSPClientSession ();
> >+ virtual ~RTSPClientSession ();
> >
> > HX_RESULT Done ();
> > HX_RESULT Init (IUnknown* pContext,
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
> >For additional commands, e-mail: dev-help@protocol.helixcommunity.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From ping at real.com Thu Oct 2 16:22:33 2003
From: ping at real.com (Henry Ping)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CR-Client: size reduction in RTSP
Message-ID: <5.1.0.14.2.20031002161338.037361b8@mailone.real.com>
Synopsis:
Re-organize & cleanup code for image size reduction
Overview:
Most changes are moving common/similar code into functions
Files Modified:
protoocl/rtsp/rtspclnt.cpp
protocol/rtsp/pub/rtspclnt.h
Files Added:
none
Image Size and Heap Use impact:
Image size reduced ~1K
No heap impact
Platforms and Profiles affected:
All platforms
Distribution Libraries affected:
none
Distribution library impact and planned action:
none
Platforms and Profiles Build Verified:
win32 and symbian-61-thumb
Platforms and Profiles Functionality verified:
win32
Branch: HEAD
-->Henry
-------------- next part --------------
? Makefile
? Umakefil.upp
? a
? dbg32
? protocol_rtsp.dsp
? protocol_rtsp.dsw
? rel32
Index: rtspclnt.cpp
===================================================================
RCS file: /cvs/protocol/rtsp/rtspclnt.cpp,v
retrieving revision 1.43
diff -u -w -4 -r1.43 rtspclnt.cpp
--- rtspclnt.cpp 2 Oct 2003 21:32:38 -0000 1.43
+++ rtspclnt.cpp 2 Oct 2003 23:10:05 -0000
@@ -868,9 +868,8 @@
HX_ASSERT(m_pSessionManager && m_pSessionManager->isValid());
if (m_pSession)
{
m_pSessionManager->removeFromSession(this, m_pSession);
- m_pSession = NULL;
}
HX_RELEASE(m_pSessionManager);
clearSocketStreamMap(m_pUDPSocketStreamMap);
@@ -1062,45 +1061,14 @@
if(pPluginGroupEnum &&
(HXR_OK == pPluginGroupEnum->Init(IID_IHXStreamDescription)))
{
IUnknown* pUnknown = NULL;
- IHXStreamDescription* pStreamDesc = NULL;
- const char* pMimeType = NULL;
-
- BOOL bIsFirst = TRUE;
ULONG32 ulNumPlugins = pPluginGroupEnum->GetNumOfPlugins();
for(ULONG32 i=0;iGetPlugin(i, pUnknown)))
{
- if
- (
- SUCCEEDED
- (
- pUnknown->QueryInterface
- (
- IID_IHXStreamDescription,
- (void**)&pStreamDesc
- )
- )
- )
- {
- if(pStreamDesc)
- {
- pStreamDesc->GetStreamDescriptionInfo(pMimeType);
- if(bIsFirst)
- {
- mimeTypes += pMimeType;
- bIsFirst = FALSE;
- }
- else
- {
- mimeTypes += ", " + (CHXString)pMimeType;
- }
- pStreamDesc->Release();
- }
- }
- pUnknown->Release();
+ GetStreamDescriptionInfo(pUnknown, mimeTypes);
}
}
}
else
@@ -1115,62 +1083,25 @@
);
if(pPluginEnumerator)
{
- IUnknown* pUnknown = 0;
- IHXStreamDescription* pStreamDesc = 0;
- const char* pMimeType = 0;
-
- BOOL bIsFirst = TRUE;
+ IUnknown* pUnknown = NULL;
ULONG32 ulNumPlugins = pPluginEnumerator->GetNumOfPlugins();
for(ULONG32 i=0;iGetPlugin(i, pUnknown)))
{
- if
- (
- SUCCEEDED
- (
- pUnknown->QueryInterface
- (
- IID_IHXStreamDescription,
- (void**)&pStreamDesc
- )
- )
- )
- {
- if(pStreamDesc)
- {
- pStreamDesc->GetStreamDescriptionInfo(pMimeType);
- if(bIsFirst)
- {
- mimeTypes += pMimeType;
- bIsFirst = FALSE;
- }
- else
- {
- mimeTypes += ", " + (CHXString)pMimeType;
- }
- pStreamDesc->Release();
- }
- }
- pUnknown->Release();
+ GetStreamDescriptionInfo(pUnknown, mimeTypes);
}
}
pPluginEnumerator->Release();
}
}
HX_RELEASE(pPluginGroupEnum);
- pMsg->addHeader("User-Agent", m_versionString);
-
pMsg->addHeader("Accept", (const char*)mimeTypes);
-
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
+ AddCommonHeaderToMsg(pMsg);
addRFC822Headers(pMsg, pValuesRequestHeaders);
appendAuthorizationHeaders(pMsg);
@@ -1490,9 +1421,11 @@
{
RTSPStreamInfo* pStreamInfo = (RTSPStreamInfo*)m_streamInfoList.GetHead();
if(pStreamInfo)
{
- return sendSetupRequestMessage( pStreamInfo,
+ return sendSetupRequestMessage
+ (
+ pStreamInfo,
pIHXValuesRequestHeaders,
TRUE
);
}
@@ -1541,22 +1474,16 @@
pMsg);
pMsg->addHeader("User-Agent", m_versionString);
- if(bFirstSetup)
- {
- if (!m_sessionID.IsEmpty())
+ if (bFirstSetup && !m_sessionID.IsEmpty())
{
pMsg->addHeader("If-Match", m_sessionID);
}
- }
- else
- {
- if (!m_sessionID.IsEmpty())
+ else if (!m_sessionID.IsEmpty())
{
pMsg->addHeader("Session", m_sessionID);
}
- }
// append stream control string to request
setSetupRequestURL(pMsg, pStreamInfo);
@@ -1852,15 +1779,10 @@
if(pMsg)
{
RTSPRange range(lFrom, lTo, RTSPRange::TR_NPT);
- pMsg->addHeader("User-Agent", m_versionString);
-
pMsg->setURL(m_url);
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
+ AddCommonHeaderToMsg(pMsg);
pMsg->addHeader("Range", (const char*)range.asString());
UINT32 seqNo = m_pSession->getNextSeqNo(this);
@@ -1894,14 +1816,11 @@
{
rc = HXR_OUTOFMEMORY;
goto overandout;
}
- pMsg->addHeader("User-Agent", m_versionString);
+
pMsg->setURL(m_url);
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
+ AddCommonHeaderToMsg(pMsg);
/*
* Add header for sequence numbers
*/
@@ -1954,15 +1873,9 @@
{
/*
* Stop the internal buffer timers
*/
- if (!m_pIsMethodSupported[PAUSE])
- {
- return HXR_OK;
- }
-
-
- if (m_transportRequestList.GetCount() == 0)
+ if (!m_pIsMethodSupported[PAUSE] || m_transportRequestList.IsEmpty())
{
return HXR_OK;
}
@@ -1970,38 +1883,12 @@
// only used when m_bNonRSRTP is TRUE
m_bPlayJustSent = FALSE;
- if( !m_transportRequestList.IsEmpty() )
- {
- RTSPTransportRequest* pRequest =
- (RTSPTransportRequest*)m_transportRequestList.GetHead();
- RTSPTransportInfo* pTransInfo = pRequest->getFirstTransportInfo();
- while(pTransInfo)
- {
- pTransInfo->m_pTransport->pauseBuffers();
- pTransInfo = pRequest->getNextTransportInfo();
- }
- }
+ SendMsgToTransport(PAUSE_BUFFER);
- HX_RESULT rc = HXR_OK;
- RTSPPauseMessage* pMsg = new RTSPPauseMessage;
- if(pMsg)
- {
- pMsg->addHeader("User-Agent", m_versionString);
- pMsg->setURL(m_url);
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
- UINT32 seqNo = m_pSession->getNextSeqNo(this);
+ HX_RESULT rc = SendMsgToServer(RTSP_PAUSE);
- rc = sendRequest(pMsg, seqNo);
- }
- else
- {
- rc = HXR_OUTOFMEMORY;
- }
m_pMutex->Unlock();
return rc;
}
@@ -2013,19 +1900,9 @@
*/
m_pMutex->Lock();
- if( !m_transportRequestList.IsEmpty() )
- {
- RTSPTransportRequest* pRequest =
- (RTSPTransportRequest*)m_transportRequestList.GetHead();
- RTSPTransportInfo* pTransInfo = pRequest->getFirstTransportInfo();
- while(pTransInfo)
- {
- pTransInfo->m_pTransport->resumeBuffers();
- pTransInfo = pRequest->getNextTransportInfo();
- }
- }
+ SendMsgToTransport(RESUME_BUFFER);
/*
* Man, iptv, teracast, and darwin server don't like this even though
* this is perfetly legal...
@@ -2036,27 +1913,10 @@
m_pMutex->Unlock();
return HXR_OK;
}
+ HX_RESULT rc = SendMsgToServer(RTSP_PLAY);
- HX_RESULT rc = HXR_OK;
- RTSPPlayMessage* pMsg = new RTSPPlayMessage;
- if(pMsg)
- {
- pMsg->addHeader("User-Agent", m_versionString);
- pMsg->setURL(m_url);
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
- UINT32 seqNo = m_pSession->getNextSeqNo(this);
-
- rc = sendRequest(pMsg, seqNo);
- }
- else
- {
- rc = HXR_OUTOFMEMORY;
- }
m_pMutex->Unlock();
return rc;
}
@@ -2071,26 +1931,10 @@
}
if (m_pSession) // it's ok if there is no session by spec.
{
- HX_RESULT rc = HXR_OK;
m_pMutex->Lock();
- RTSPTeardownMessage* pMsg = new RTSPTeardownMessage;
- if(pMsg)
- {
- pMsg->addHeader("User-Agent", m_versionString);
- pMsg->setURL(m_url);
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
- UINT32 seqNo = m_pSession->getNextSeqNo(this);
- rc = sendRequest(pMsg, seqNo);
- }
- else
- {
- rc = HXR_OUTOFMEMORY;
- }
+ HX_RESULT rc = SendMsgToServer(RTSP_TEARDOWN);
m_pMutex->Unlock();
return rc;
}
return HXR_OK;
@@ -2162,21 +2006,10 @@
if (!m_bUseLegacyTimeOutMsg ||
!m_pIsMethodSupported[SET_PARAM] ||
m_bNoKeepAlive)
{
- RTSPOptionsMessage* pMsg = new RTSPOptionsMessage;
-
- // construct "rtsp://%-.200s:%u"
- pMsg->setURL(m_url);
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
- pMsg->addHeader("User-Agent", m_versionString);
- UINT32 seqNo = m_pSession->getNextSeqNo(this);
-
m_bKeepAlivePending = TRUE;
- rc = sendRequest(pMsg, seqNo);
+ SendMsgToServer(RTSP_OPTIONS);
}
else
{
RTSPSetParamMessage* pMsg = new RTSPSetParamMessage;
@@ -2187,10 +2020,10 @@
if(pAlertHeader)
{
pAlertHeader->addHeaderValue("Pong");
pMsg->addHeader(pAlertHeader);
- pMsg->addHeader("User-Agent", m_versionString);
- pMsg->addHeader("Session", m_sessionID);
+
+ AddCommonHeaderToMsg(pMsg);
UINT32 seqNo = m_pSession->getNextSeqNo(this);
sendRequest(pMsg, seqNo);
}
@@ -2545,10 +2378,10 @@
RTSPGetParamMessage* pMsg = new RTSPGetParamMessage;
if(pMsg)
{
pMsg->setURL("*");
+ AddCommonHeaderToMsg(pMsg);
UINT32 seqNo = m_pSession->getNextSeqNo(this);
- pMsg->addHeader("User-Agent", m_versionString);
rc = sendRequest(pMsg, pParamName, "text/rtsp-parameters", seqNo);
}
else
{
@@ -2568,19 +2401,15 @@
}
m_pMutex->Lock();
RTSPSetParamMessage* pMsg = new RTSPSetParamMessage;
- pMsg->addHeader("User-Agent", m_versionString);
pMsg->setURL(m_url);
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
+ AddCommonHeaderToMsg(pMsg);
+
pMsg->addHeader(pParamName, (const char*)pParamValue->GetBuffer());
UINT32 seqNo = m_pSession->getNextSeqNo(this);
HX_RESULT rc = sendRequest(pMsg, seqNo);
-
m_pMutex->Unlock();
return rc;
}
@@ -2596,14 +2425,10 @@
m_pMutex->Lock();
RTSPSetParamMessage* pMsg = new RTSPSetParamMessage;
pMsg->setURL(m_url);
- pMsg->addHeader("User-Agent", m_versionString);
+ AddCommonHeaderToMsg(pMsg);
- if (!m_sessionID.IsEmpty())
- {
- pMsg->addHeader("Session", m_sessionID);
- }
pMsg->addHeader(pParamName, pParamValue);
UINT32 seqNo = m_pSession->getNextSeqNo(this);
HX_RESULT rc = sendRequest(pMsg, pContent, pMimeType, seqNo);
@@ -4288,9 +4113,127 @@
HX_RELEASE(pAgent);
return sdpType;
}
+HX_RESULT
+RTSPClientProtocol::GetStreamDescriptionInfo(IUnknown* pUnknown, CHXString& mimeTypes)
+{
+ HX_RESULT rc = HXR_OK;
+ const char* pMimeType = NULL;
+ BOOL bIsFirst = TRUE;
+ IHXStreamDescription* pStreamDesc = NULL;
+
+ if (HXR_OK == pUnknown->QueryInterface(IID_IHXStreamDescription,(void**)&pStreamDesc) &&
+ pStreamDesc)
+ {
+ pStreamDesc->GetStreamDescriptionInfo(pMimeType);
+ if(bIsFirst)
+ {
+ mimeTypes += pMimeType;
+ bIsFirst = FALSE;
+ }
+ else
+ {
+ mimeTypes += ", " + (CHXString)pMimeType;
+ }
+ pStreamDesc->Release();
+ }
+
+ return rc;
+}
+
+void
+RTSPClientProtocol::SendMsgToTransport(TRANSPORT_MSG msg)
+{
+ RTSPTransportRequest* pRequest = NULL;
+ RTSPTransportInfo* pTransInfo = NULL;
+
+ if (!m_transportRequestList.IsEmpty())
+ {
+ pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
+ pTransInfo = pRequest->getFirstTransportInfo();
+ while(pTransInfo)
+ {
+ switch (msg)
+ {
+ case ENTER_PREFETCH:
+ pTransInfo->m_pTransport->EnterPrefetch();
+ break;
+ case LEAVE_PREFETCH:
+ pTransInfo->m_pTransport->LeavePrefetch();
+ break;
+ case ENTER_FASTSTART:
+ pTransInfo->m_pTransport->EnterFastStart();
+ break;
+ case LEAVE_FASTSTART:
+ pTransInfo->m_pTransport->LeaveFastStart();
+ break;
+ case PAUSE_BUFFER:
+ pTransInfo->m_pTransport->pauseBuffers();
+ break;
+ case RESUME_BUFFER:
+ pTransInfo->m_pTransport->resumeBuffers();
+ break;
+ default:
+ break;
+ }
+ pTransInfo = pRequest->getNextTransportInfo();
+ }
+ }
+}
+void
+RTSPClientProtocol::AddCommonHeaderToMsg(RTSPRequestMessage* pMsg)
+{
+ if (pMsg)
+ {
+ pMsg->addHeader("User-Agent", m_versionString);
+ if (!m_sessionID.IsEmpty())
+ {
+ pMsg->addHeader("Session", m_sessionID);
+ }
+ }
+}
+
+HX_RESULT
+RTSPClientProtocol::SendMsgToServer(RTSPMethod msg)
+{
+ HX_RESULT rc = HXR_OK;
+ RTSPRequestMessage* pMsg = NULL;
+
+ switch(msg)
+ {
+ case RTSP_PLAY:
+ pMsg = new RTSPPlayMessage;
+ break;
+ case RTSP_PAUSE:
+ pMsg = new RTSPPauseMessage;
+ break;
+ case RTSP_OPTIONS:
+ pMsg = new RTSPOptionsMessage;
+ break;
+ case RTSP_TEARDOWN:
+ pMsg = new RTSPTeardownMessage;
+ break;
+ default:
+ break;
+ }
+
+ if (pMsg)
+ {
+ pMsg->setURL(m_url);
+ AddCommonHeaderToMsg(pMsg);
+
+ UINT32 seqNo = m_pSession->getNextSeqNo(this);
+ rc = sendRequest(pMsg, seqNo);
+ }
+ else
+ {
+ rc = HXR_OUTOFMEMORY;
+ }
+
+ return rc;
+}
HX_RESULT
RTSPClientProtocol::handleOptionsResponse
(
@@ -4359,66 +4302,46 @@
if (HXR_OK == pResponseHeaders->GetPropertyCString("Allow", pCmds) ||
HXR_OK == pResponseHeaders->GetPropertyCString("Public", pCmds) ||
HXR_OK == pResponseHeaders->GetPropertyCString("Public ", pCmds))
{
- // Is setup supported
- if (strstr((char*)pCmds->GetBuffer(), "SETUP"))
- m_pIsMethodSupported[SETUP] = TRUE;
- else
+ // all methods are supported by default
+ if (!strstr((char*)pCmds->GetBuffer(), "SETUP"))
m_pIsMethodSupported[SETUP] = FALSE;
// Is redirect supported
- if (strstr((char*)pCmds->GetBuffer(), "REDIRECT"))
- m_pIsMethodSupported[REDIRECT] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "REDIRECT"))
m_pIsMethodSupported[REDIRECT] = FALSE;
// Is play supported
- if (strstr((char*)pCmds->GetBuffer(), "PLAY"))
- m_pIsMethodSupported[PLAY] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "PLAY"))
m_pIsMethodSupported[PLAY] = FALSE;
// Is pause supported
- if (strstr((char*)pCmds->GetBuffer(), "PAUSE"))
- m_pIsMethodSupported[PAUSE] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "PAUSE"))
m_pIsMethodSupported[PAUSE] = FALSE;
// Is set_param supported
- if (strstr((char*)pCmds->GetBuffer(), "SET_PARAMETER"))
- m_pIsMethodSupported[SET_PARAM] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "SET_PARAMETER"))
m_pIsMethodSupported[SET_PARAM] = FALSE;
// Is get_param supported
- if (strstr((char*)pCmds->GetBuffer(), "GET_PARAMETER"))
- m_pIsMethodSupported[GET_PARAM] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "GET_PARAMETER"))
m_pIsMethodSupported[GET_PARAM] = FALSE;
// Is describe supported
- if (strstr((char*)pCmds->GetBuffer(), "DESCRIBE"))
- m_pIsMethodSupported[DESCRIBE] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "DESCRIBE"))
m_pIsMethodSupported[DESCRIBE] = FALSE;
// Is teardown supported
- if (strstr((char*)pCmds->GetBuffer(), "TEARDOWN"))
- m_pIsMethodSupported[TEARDOWN] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "TEARDOWN"))
m_pIsMethodSupported[TEARDOWN] = FALSE;
// Is record supported
- if (strstr((char*)pCmds->GetBuffer(), "RECORD"))
- m_pIsMethodSupported[RECORD] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "RECORD"))
m_pIsMethodSupported[RECORD] = FALSE;
// Is announce supported
- if (strstr((char*)pCmds->GetBuffer(), "ANNOUNCE"))
- m_pIsMethodSupported[ANNOUNCE] = TRUE;
- else
+ if (!strstr((char*)pCmds->GetBuffer(), "ANNOUNCE"))
m_pIsMethodSupported[ANNOUNCE] = FALSE;
}
HX_RELEASE(pCmds);
@@ -6274,68 +6197,29 @@
void
RTSPClientProtocol::LeavePrefetch(void)
{
- RTSPTransportRequest* pRequest = NULL;
- RTSPTransportInfo* pTransInfo = NULL;
-
m_bPrefetch = FALSE;
-
- if( !m_transportRequestList.IsEmpty() )
- {
- pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
- pTransInfo = pRequest->getFirstTransportInfo();
- while(pTransInfo)
- {
- pTransInfo->m_pTransport->LeavePrefetch();
- pTransInfo = pRequest->getNextTransportInfo();
- }
- }
+ SendMsgToTransport(LEAVE_PREFETCH);
return;
}
void
RTSPClientProtocol::EnterFastStart(void)
{
- RTSPTransportRequest* pRequest = NULL;
- RTSPTransportInfo* pTransInfo = NULL;
-
m_bFastStart = TRUE;
-
- if( !m_transportRequestList.IsEmpty() )
- {
- pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
- pTransInfo = pRequest->getFirstTransportInfo();
- while(pTransInfo)
- {
- pTransInfo->m_pTransport->EnterFastStart();
- pTransInfo = pRequest->getNextTransportInfo();
- }
- }
-
+ SendMsgToTransport(ENTER_FASTSTART);
return;
}
void
RTSPClientProtocol::LeaveFastStart(void)
{
- RTSPTransportRequest* pRequest = NULL;
- RTSPTransportInfo* pTransInfo = NULL;
-
m_bFastStart = FALSE;
+ SendMsgToTransport(LEAVE_FASTSTART);
- if( !m_transportRequestList.IsEmpty() )
- {
- pRequest = (RTSPTransportRequest*)m_transportRequestList.GetHead();
- pTransInfo = pRequest->getFirstTransportInfo();
- while(pTransInfo)
- {
- pTransInfo->m_pTransport->LeaveFastStart();
- pTransInfo = pRequest->getNextTransportInfo();
- }
- }
return;
}
void
@@ -7370,13 +7254,9 @@
}
RTSPClientProtocol::TimeoutCallback::~TimeoutCallback()
{
- if (m_pOwner)
- {
- m_pOwner->Release();
- m_pOwner = NULL;
- }
+ HX_RELEASE(m_pOwner);
}
STDMETHODIMP
RTSPClientProtocol::TimeoutCallback::QueryInterface(REFIID riid, void** ppvObj)
@@ -8392,20 +8272,18 @@
m_bSetSessionCalled = TRUE;
m_pConnectingProt->SessionFailed(this, m_pSessionSocket);
+ m_pConnectingProt->AddRef();
if (m_bReopenSocket)
{
- m_pConnectingProt->AddRef();
m_pConnectingProt->ReopenSocketDone(HXR_NET_CONNECT);
- m_pConnectingProt->Release();
}
else
{
- m_pConnectingProt->AddRef();
m_pConnectingProt->InitDone(HXR_NET_CONNECT);
- m_pConnectingProt->Release();
}
+ m_pConnectingProt->Release();
m_pConnectingProt = 0;
return HXR_FAIL;
}
Index: pub/rtspclnt.h
===================================================================
RCS file: /cvs/protocol/rtsp/pub/rtspclnt.h,v
retrieving revision 1.12
diff -u -w -4 -r1.12 rtspclnt.h
--- pub/rtspclnt.h 2 Oct 2003 22:36:40 -0000 1.12
+++ pub/rtspclnt.h 2 Oct 2003 23:10:06 -0000
@@ -79,8 +79,18 @@
ALTERNATE_SERVER,
ALTERNATE_PROXY
} ReconnectType;
+typedef enum
+{
+ ENTER_PREFETCH = 0,
+ LEAVE_PREFETCH,
+ ENTER_FASTSTART,
+ LEAVE_FASTSTART,
+ PAUSE_BUFFER,
+ RESUME_BUFFER
+} TRANSPORT_MSG;
+
typedef struct _ReconnectInfo
{
CHXString m_server;
UINT32 m_ulPort;
@@ -856,8 +866,13 @@
/* since Allow doesn't deal with encoder stuff, just do it here */
/* depending on the result, we will use either old or new sdp file */
SdpFileType GetSdpFileTypeWeNeed(IHXValues* pHeaders);
+ HX_RESULT GetStreamDescriptionInfo(IUnknown* pUnknown, CHXString& mimeTypes);
+ void SendMsgToTransport(TRANSPORT_MSG msg);
+ void AddCommonHeaderToMsg(RTSPRequestMessage* pMsg);
+ HX_RESULT SendMsgToServer(RTSPMethod msg);
+
HX_RESULT extractRealmInformation(RTSPResponseMessage* pMsg);
HX_RESULT extractExistingAuthorizationInformation(IHXValues* pIHXValuesRequestHeaders);
void appendAuthorizationHeaders(/*RTSPDescribeMessage*/ RTSPMessage* pMsg);
-------------- next part --------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From acolwell at real.com Thu Oct 2 16:43:37 2003
From: acolwell at real.com (Aaron Colwell)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CR-Client: size reduction in RTSP
In-Reply-To: <5.1.0.14.2.20031002161338.037361b8@mailone.real.com>
Message-ID:
These look good except for the m_pOwner change. You can't use HX_RELEASE()
on that object because the first class it derives from is not a COM
interface. A few days ago I fixed this problem. Perhaps a comment there
would be helpful.
You also might want to check you SendMsgToServer() calls. I think I saw
one or 2 places where you are ignoring the return code and the original
code wasn't doing so.
Aaron
On Thu, 2 Oct 2003, Henry Ping wrote:
> Synopsis:
> Re-organize & cleanup code for image size reduction
>
> Overview:
> Most changes are moving common/similar code into functions
>
> Files Modified:
> protoocl/rtsp/rtspclnt.cpp
> protocol/rtsp/pub/rtspclnt.h
>
> Files Added:
> none
>
> Image Size and Heap Use impact:
> Image size reduced ~1K
> No heap impact
>
> Platforms and Profiles affected:
> All platforms
>
> Distribution Libraries affected:
> none
>
> Distribution library impact and planned action:
> none
>
> Platforms and Profiles Build Verified:
> win32 and symbian-61-thumb
>
> Platforms and Profiles Functionality verified:
> win32
>
> Branch: HEAD
>
> -->Henry
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From ping at real.com Thu Oct 2 17:10:35 2003
From: ping at real.com (Henry Ping)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CN-Client: size reduction in RTSP
In-Reply-To:
References: <5.1.0.14.2.20031002161338.037361b8@mailone.real.com>
Message-ID: <5.1.0.14.2.20031002170836.03e997e0@mailone.real.com>
checked in with Aaron's feedback
Modified by: ping@real.com
Reviewed by: aaron@real.com
Date: 10/2/03
-->Henry
At 04:43 PM 10/2/2003 -0700, Aaron Colwell wrote:
>These look good except for the m_pOwner change. You can't use HX_RELEASE()
>on that object because the first class it derives from is not a COM
>interface. A few days ago I fixed this problem. Perhaps a comment there
>would be helpful.
>
>You also might want to check you SendMsgToServer() calls. I think I saw
>one or 2 places where you are ignoring the return code and the original
>code wasn't doing so.
>
>Aaron
>
>On Thu, 2 Oct 2003, Henry Ping wrote:
>
> > Synopsis:
> > Re-organize & cleanup code for image size reduction
> >
> > Overview:
> > Most changes are moving common/similar code into functions
> >
> > Files Modified:
> > protoocl/rtsp/rtspclnt.cpp
> > protocol/rtsp/pub/rtspclnt.h
> >
> > Files Added:
> > none
> >
> > Image Size and Heap Use impact:
> > Image size reduced ~1K
> > No heap impact
> >
> > Platforms and Profiles affected:
> > All platforms
> >
> > Distribution Libraries affected:
> > none
> >
> > Distribution library impact and planned action:
> > none
> >
> > Platforms and Profiles Build Verified:
> > win32 and symbian-61-thumb
> >
> > Platforms and Profiles Functionality verified:
> > win32
> >
> > Branch: HEAD
> >
> > -->Henry
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From jmevissen at real.com Fri Oct 17 16:39:08 2003
From: jmevissen at real.com (John Mevissen)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CR: rtptran optimization
Message-ID: <200310172339.h9HNd8c05322@ real.com>
Remove a memcpy in RTPBaseTransport::_handlePacket() by using an
IHXStaticBuffer.
Remove two memcpy`s in RTPTCPTransport::writePacket() by simply writing a
two IHXBuffers.
Since everything has to be an IHXBuffer before it gets written, I simply
make makePacket() return an IHXBuffer, and got rid of the write() routines
that took a char buffer and length as arguments.
Image Size and Heap Use impact:
Image size reduced 672 bytes (on win32)
No heap impact
Incoming packet functionality verified on win32, outgoing packets tested on
linux.
This is for the HEAD.
John
-------------- next part --------------
Index: rtptran.cpp
===================================================================
RCS file: /cvs/protocol/transport/rtp/rtptran.cpp,v
retrieving revision 1.44
diff -u -r1.44 rtptran.cpp
--- rtptran.cpp 15 Oct 2003 22:55:42 -0000 1.44
+++ rtptran.cpp 17 Oct 2003 23:27:44 -0000
@@ -51,6 +51,7 @@
#include "netbyte.h"
#include "hxengin.h"
#include "ihxpckts.h"
+#include "hxsbuffer.h"
#include "hxcomm.h"
#include "hxmon.h"
#include "netbyte.h"
@@ -841,11 +842,11 @@
}
}
+// The pPacketBuf is returned with an AddRef(), as it must.
HX_RESULT
RTPBaseTransport::makePacket(BasePacket* pBasePacket,
- REF(BYTE*) pData,
- REF(UINT32) ulLen)
+ REF(IHXBuffer*) pPacketBuf)
{
if(!m_bIsSource)
{
@@ -1068,10 +1069,13 @@
? sizeof(UINT16) + (pkt.op_code_data_length * sizeof(UINT32))
: 0);
- BYTE* packet = new BYTE[packetLen];
- if(packet)
+ IHXBuffer* pPacketOut = new CHXBuffer();
+ if(pPacketOut)
{
- pkt.pack(packet, packetLen);
+ pPacketOut->AddRef();
+ pPacketOut->SetSize(packetLen);
+ pkt.pack(pPacketOut->GetBuffer(), packetLen);
+ pPacketOut->SetSize(packetLen); //update with actual packed length
#ifdef DEBUG
if (m_drop_packets && ++m_packets_since_last_drop % 10 == 0)
@@ -1091,8 +1095,7 @@
// out params...
- pData = packet;
- ulLen = packetLen;
+ pPacketBuf = pPacketOut;
/* update */
m_pReportHandler->OnRTPSend(pkt.seq_no, 1, pBasePacket->GetSize(), pkt.timestamp);
@@ -1366,11 +1369,14 @@
hresult = HXR_OUTOFMEMORY;
}
- CHXBuffer* pPktBuffer = new CHXBuffer;
+ UINT32 dataOffset=
+ (UINT32)((PTR_INT)pkt.data.data - (PTR_INT)pBuffer->GetBuffer());
+ IHXBuffer* pPktBuffer =
+ new CHXStaticBuffer(pBuffer, dataOffset, pkt.data.len);
+
if(pPktBuffer)
{
pPktBuffer->AddRef();
- hresult = pPktBuffer->Set((BYTE*)pkt.data.data, pkt.data.len);
}
else
{
@@ -1865,26 +1871,6 @@
return m_pUDPSocket->WriteTo(m_foreignAddr, m_foreignPort, pSendBuffer);
}
-HX_RESULT
-RTPUDPTransport::writePacket(BYTE* pData, UINT32 dataLen)
-{
- m_keepAlive.OnActivity();
- HX_RESULT rc = HXR_OK;
-
- CHXBuffer* pSendBuffer = new CHXBuffer(pData, dataLen);
- if(pSendBuffer)
- {
- pSendBuffer->AddRef();
- rc = m_pUDPSocket->WriteTo(m_foreignAddr, m_foreignPort, pSendBuffer);
- pSendBuffer->Release();
- }
- else
- {
- rc = HXR_OUTOFMEMORY;
- }
- return rc;
-}
-
/*
* XXXMC
* Special-case handling for PV clients
@@ -1928,14 +1914,13 @@
return theErr;
}
- BYTE* pData = NULL;
- UINT32 ulLen = 0;
+ IHXBuffer* pPacketBuf = NULL;
- theErr = makePacket(pPacket, pData, ulLen);
+ theErr = makePacket(pPacket, pPacketBuf);
if (HXR_OK == theErr)
{
- theErr = writePacket(pData, ulLen);
+ theErr = writePacket(pPacketBuf);
/* send SR if necessary */
if (HXR_OK == theErr && m_pRTCPTran->m_bSendReport &&
@@ -1947,6 +1932,7 @@
}
}
+ HX_RELEASE(pPacketBuf);
return theErr;
}
@@ -2092,7 +2078,7 @@
if (HXR_OK == theErr)
{
- theErr = writePacket(pSendBuf->GetBuffer(), pSendBuf->GetSize());
+ theErr = writePacket(pSendBuf);
pSendBuf->Release();
}
else if (HXR_IGNORE == theErr)
@@ -2103,17 +2089,13 @@
return theErr;
}
- BYTE* pData = NULL;
- UINT32 ulLen = 0;
+ IHXBuffer* pPacketBuf = NULL;
- theErr = makePacket(pPacket, pData, ulLen);
+ theErr = makePacket(pPacket, pPacketBuf);
if (HXR_OK == theErr)
{
- theErr = writePacket(pData, ulLen);
- // can't delete this in :writePacket because reflector routine
- // is passing in pSendBuf->GetBuffer().
- HX_VECTOR_DELETE(pData);
+ theErr = writePacket(pPacketBuf);
/* send SR if necessary */
if (HXR_OK == theErr && m_pRTCPTran->m_bSendReport &&
@@ -2125,14 +2107,17 @@
}
}
+ HX_RELEASE(pPacketBuf);
return theErr;
}
HX_RESULT
-RTPTCPTransport::writePacket(BYTE* pData, UINT32 dataLen)
+RTPTCPTransport::writePacket(IHXBuffer* pBuf)
{
// need to put $\000[datalen] in front of packet data
+ UINT32 dataLen = pBuf->GetSize();
+
if(dataLen > 0xffff)
{
return HXR_FAIL;
@@ -2141,36 +2126,32 @@
//XXXTDM: always true, m_tcpInteleave is signed (why?)
//HX_ASSERT(0xFF != m_tcpInterleave);
- BYTE* pPacketData = new BYTE[dataLen+4];
- if(!pPacketData)
+ IHXBuffer* pHeader = new CHXBuffer;
+ BYTE* pHeaderData;
+
+ if(!pHeader)
{
return HXR_OUTOFMEMORY;
}
- pPacketData[0] = '$';
- pPacketData[1] = m_tcpInterleave;
- putshort(&pPacketData[2], (UINT16)dataLen);
- memcpy(&pPacketData[4], pData, HX_SAFESIZE_T(dataLen)); /* Flawfinder: ignore */
- HX_RESULT rc = HXR_OK;
- CHXBuffer* pSendBuffer = new CHXBuffer;
- if(pSendBuffer)
+ pHeader->AddRef();
+ pHeader->SetSize(4);
+ pHeaderData = pHeader->GetBuffer();
+
+ pHeaderData[0] = '$';
+ pHeaderData[1] = m_tcpInterleave;
+ putshort(&pHeaderData[2], (UINT16)dataLen);
+
+ HX_RESULT rc;
+ rc = m_pTCPSocket->Write(pHeader);
+ if (SUCCEEDED(rc))
{
- rc = pSendBuffer->Set(pPacketData, dataLen + 4);
- if( rc != HXR_OUTOFMEMORY )
- {
- pSendBuffer->AddRef();
- rc = m_pTCPSocket->Write(pSendBuffer);
- if(rc)
- {
- m_pResp->OnProtocolError(HXR_NET_SOCKET_INVALID);
- }
- pSendBuffer->Release();
- }
+ rc = m_pTCPSocket->Write(pBuf);
}
- else
+ if(rc)
{
- rc = HXR_OUTOFMEMORY;
+ m_pResp->OnProtocolError(HXR_NET_SOCKET_INVALID);
}
- delete[] pPacketData;
+ pHeader->Release();
return rc;
}
@@ -3491,7 +3472,7 @@
RTCPTCPTransport::reflectRTCP(IHXBuffer* pSendBuf)
{
HX_ASSERT(pSendBuf);
- HX_RESULT theErr = writePacket(pSendBuf->GetBuffer(), pSendBuf->GetSize());
+ HX_RESULT theErr = writePacket(pSendBuf);
if (theErr)
{
m_pResp->OnProtocolError(HXR_NET_SOCKET_INVALID);
@@ -3564,54 +3545,7 @@
return theErr;
}
-/*
- * if we are reflecting, there will be more than 1 AddRef on a buffer and
- * ->Set() will fail. So, need to crate a new buffer...
- */
-HX_RESULT
-RTCPTCPTransport::writePacket(BYTE* pData, UINT32 dataLen)
-{
- // need to put $\000[datalen] in front of packet data
- if(dataLen > 0xffff)
- {
- return HXR_FAIL;
- }
-
- //XXXTDM: always true, m_tcpInteleave is signed (why?)
- //HX_ASSERT(0xFF != m_tcpInterleave);
-
- HX_RESULT theErr = HXR_OK;
- CHXBuffer* pSendBuffer = new CHXBuffer;
- if(pSendBuffer)
- {
- pSendBuffer->AddRef();
- theErr = pSendBuffer->SetSize(dataLen + 4);
- if( theErr != HXR_OUTOFMEMORY )
- {
- BYTE* pc = pSendBuffer->GetBuffer();
- pc[0] = '$';
- pc[1] = m_tcpInterleave;
- putshort(&pc[2], (UINT16)dataLen);
- memcpy(&pc[4], pData, HX_SAFESIZE_T(dataLen)); /* Flawfinder: ignore */
- theErr = m_pTCPSocket->Write(pSendBuffer);
- if(theErr)
- {
- m_pResp->OnProtocolError(HXR_NET_SOCKET_INVALID);
- }
- }
- pSendBuffer->Release();
- }
- else
- {
- theErr = HXR_OUTOFMEMORY;
- }
- return theErr;
-}
-
-/*
- * there shouldn't be more than 1 addref...
- */
HX_RESULT
RTCPTCPTransport::writePacket(IHXBuffer* pBuf)
{
@@ -3627,31 +3561,28 @@
//XXXTDM: always true, m_tcpInteleave is signed (why?)
//HX_ASSERT(0xFF != m_tcpInterleave);
- /*
- * XXXGo - we should do the same as above...
- */
+ IHXBuffer* pHeader = new CHXBuffer;
+ BYTE* pHeaderData;
- HX_RESULT rc = HXR_OK;
- BYTE* pPacketData = new BYTE[dataLen+4];
- if(pPacketData)
- {
- pPacketData[0] = '$';
- pPacketData[1] = m_tcpInterleave;
- putshort(&pPacketData[2], (UINT16)dataLen);
- memcpy(&pPacketData[4], pBuf->GetBuffer(), HX_SAFESIZE_T(dataLen)); /* Flawfinder: ignore */
- rc = pBuf->Set(pPacketData, dataLen + 4);
- HX_ASSERT(HXR_OK == rc);
- if( rc != HXR_OUTOFMEMORY )
- {
- rc = m_pTCPSocket->Write(pBuf);
- }
-
- delete[] pPacketData;
+ if(!pHeader)
+ {
+ return HXR_OUTOFMEMORY;
}
- else
+ pHeader->AddRef();
+ pHeader->SetSize(4);
+ pHeaderData = pHeader->GetBuffer();
+
+ pHeaderData[0] = '$';
+ pHeaderData[1] = m_tcpInterleave;
+ putshort(&pHeaderData[2], (UINT16)dataLen);
+
+ HX_RESULT rc;
+ rc = m_pTCPSocket->Write(pHeader);
+ if (SUCCEEDED(rc))
{
- rc = HXR_OUTOFMEMORY;
+ rc = m_pTCPSocket->Write(pBuf);
}
+ pHeader->Release();
return rc;
}
Index: pub/rtptran.h
===================================================================
RCS file: /cvs/protocol/transport/rtp/pub/rtptran.h,v
retrieving revision 1.19
diff -u -r1.19 rtptran.h
--- pub/rtptran.h 15 Oct 2003 18:44:18 -0000 1.19
+++ pub/rtptran.h 17 Oct 2003 23:27:44 -0000
@@ -132,7 +132,7 @@
HX_RESULT init ();
HX_RESULT reflectPacket (BasePacket* pBasePacket, REF(IHXBuffer*)pSendBuf);
- HX_RESULT makePacket (BasePacket* pPacket, REF(BYTE*) pData, REF(UINT32) ulLen);
+ HX_RESULT makePacket (BasePacket* pPacket, REF(IHXBuffer*) pPacketBuf);
HX_RESULT handlePacket (IHXBuffer* pBuffer);
HX_RESULT handleMasterSync (ULONG32 ulHXTime, LONG32 lHXOffsetToMaster);
@@ -368,7 +368,6 @@
HX_RESULT onNATKeepAlive();
private:
- HX_RESULT writePacket (BYTE* pData, UINT32 dataLen);
HX_RESULT writePacket (IHXBuffer* pSendBuffer);
IHXUDPSocket* m_pUDPSocket;
@@ -423,7 +422,7 @@
IHXTCPSocket* m_pTCPSocket;
private:
- HX_RESULT writePacket (BYTE* pData, UINT32 dataLen);
+ HX_RESULT writePacket (IHXBuffer* pBuf);
INT8 m_tcpInterleave;
@@ -675,7 +674,6 @@
HX_RESULT sendReceiverReport ();
HX_RESULT sendBye ();
HX_RESULT writePacket (IHXBuffer* pBuf);
- HX_RESULT writePacket (BYTE* pData, UINT32 dataLen);
IHXTCPSocket* m_pTCPSocket;
INT8 m_tcpInterleave;
-------------- next part --------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From ehyche at real.com Mon Oct 20 06:09:50 2003
From: ehyche at real.com (Eric Hyche)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CR: rtptran optimization
In-Reply-To: <200310172339.h9HNd8c05322@ real.com>
Message-ID: <5.1.0.14.2.20031020090358.02f336b0@mailone.real.com>
John,
If there is easy access to a context in this class, we should
create IHXBuffer's from the common class factory instead
of "new CHXBuffer".
Eric
At 04:39 PM 10/17/2003 -0700, John Mevissen wrote:
>Remove a memcpy in RTPBaseTransport::_handlePacket() by using an
>IHXStaticBuffer.
>
>Remove two memcpy`s in RTPTCPTransport::writePacket() by simply writing a
>two IHXBuffers.
>
>Since everything has to be an IHXBuffer before it gets written, I simply
>make makePacket() return an IHXBuffer, and got rid of the write() routines
>that took a char buffer and length as arguments.
>
>Image Size and Heap Use impact:
>Image size reduced 672 bytes (on win32)
>No heap impact
>
>Incoming packet functionality verified on win32, outgoing packets tested on
>linux.
>
>This is for the HEAD.
>
>John
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
>For additional commands, e-mail: dev-help@protocol.helixcommunity.org
======================================
M. Eric Hyche (ehyche@real.com)
Core Technologies
RealNetworks, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From jmevissen at real.com Mon Oct 20 15:14:28 2003
From: jmevissen at real.com (John Mevissen)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CR: rtptran optimization
In-Reply-To: Your message of Mon, 20 Oct 2003 09:09:50 EDT.
Message-ID: <200310202214.h9KMESM09733@ real.com>
Changes made. New diff attached.
John
On Mon, 20 Oct 2003 09:09:50 EDT,
Eric Hyche (ehyche) writes:
>
>
> John,
>
> If there is easy access to a context in this class, we should
> create IHXBuffer's from the common class factory instead
> of "new CHXBuffer".
>
> Eric
>
> At 04:39 PM 10/17/2003 -0700, John Mevissen wrote:
>>Remove a memcpy in RTPBaseTransport::_handlePacket() by using an
>>IHXStaticBuffer.
>>
>>Remove two memcpy`s in RTPTCPTransport::writePacket() by simply writing a
>>two IHXBuffers.
>>
>>Since everything has to be an IHXBuffer before it gets written, I simply
>>make makePacket() return an IHXBuffer, and got rid of the write() routines
>>that took a char buffer and length as arguments.
>>
>>Image Size and Heap Use impact:
>>Image size reduced 672 bytes (on win32)
>>No heap impact
>>
>>Incoming packet functionality verified on win32, outgoing packets tested on
>>linux.
>>
>>This is for the HEAD.
>>
>>John
-------------- next part --------------
Index: rtptran.cpp
===================================================================
RCS file: /cvs/protocol/transport/rtp/rtptran.cpp,v
retrieving revision 1.44
diff -u -r1.44 rtptran.cpp
--- rtptran.cpp 15 Oct 2003 22:55:42 -0000 1.44
+++ rtptran.cpp 20 Oct 2003 22:10:40 -0000
@@ -51,6 +51,7 @@
#include "netbyte.h"
#include "hxengin.h"
#include "ihxpckts.h"
+#include "hxsbuffer.h"
#include "hxcomm.h"
#include "hxmon.h"
#include "netbyte.h"
@@ -841,11 +842,11 @@
}
}
+// The pPacketBuf is returned with an AddRef(), as it must.
HX_RESULT
RTPBaseTransport::makePacket(BasePacket* pBasePacket,
- REF(BYTE*) pData,
- REF(UINT32) ulLen)
+ REF(IHXBuffer*) pPacketBuf)
{
if(!m_bIsSource)
{
@@ -1063,15 +1064,19 @@
* Create enough space to account for the op code and
* op code data if the extension bit is set
*/
- packetLen = pkt.static_size() + pBuffer->GetSize() +
+ packetLen = pkt.static_size() + pBuffer->GetSize() +
(pkt.extension_flag
? sizeof(UINT16) + (pkt.op_code_data_length * sizeof(UINT32))
: 0);
- BYTE* packet = new BYTE[packetLen];
- if(packet)
- {
- pkt.pack(packet, packetLen);
+ IHXBuffer* pPacketOut = NULL;
+ m_pCommonClassFactory->CreateInstance(IID_IHXBuffer,
+ (void**)&pPacketOut);
+ if(pPacketOut)
+ {
+ pPacketOut->SetSize(packetLen);
+ pkt.pack(pPacketOut->GetBuffer(), packetLen);
+ pPacketOut->SetSize(packetLen); //update with actual packed length
#ifdef DEBUG
if (m_drop_packets && ++m_packets_since_last_drop % 10 == 0)
@@ -1083,16 +1088,14 @@
m_ulPacketsSent++;
m_lBytesSent += pBasePacket->GetSize();
- if (m_pQoSInfo)
- {
- m_pQoSInfo->SetBytesSent(m_lBytesSent);
- m_pQoSInfo->SetPacketsSent(m_ulPacketsSent);
- }
-
+ if (m_pQoSInfo)
+ {
+ m_pQoSInfo->SetBytesSent(m_lBytesSent);
+ m_pQoSInfo->SetPacketsSent(m_ulPacketsSent);
+ }
// out params...
- pData = packet;
- ulLen = packetLen;
+ pPacketBuf = pPacketOut;
/* update */
m_pReportHandler->OnRTPSend(pkt.seq_no, 1, pBasePacket->GetSize(), pkt.timestamp);
@@ -1366,11 +1369,14 @@
hresult = HXR_OUTOFMEMORY;
}
- CHXBuffer* pPktBuffer = new CHXBuffer;
+ UINT32 dataOffset=
+ (UINT32)((PTR_INT)pkt.data.data - (PTR_INT)pBuffer->GetBuffer());
+ IHXBuffer* pPktBuffer =
+ new CHXStaticBuffer(pBuffer, dataOffset, pkt.data.len);
+
if(pPktBuffer)
{
pPktBuffer->AddRef();
- hresult = pPktBuffer->Set((BYTE*)pkt.data.data, pkt.data.len);
}
else
{
@@ -1865,26 +1871,6 @@
return m_pUDPSocket->WriteTo(m_foreignAddr, m_foreignPort, pSendBuffer);
}
-HX_RESULT
-RTPUDPTransport::writePacket(BYTE* pData, UINT32 dataLen)
-{
- m_keepAlive.OnActivity();
- HX_RESULT rc = HXR_OK;
-
- CHXBuffer* pSendBuffer = new CHXBuffer(pData, dataLen);
- if(pSendBuffer)
- {
- pSendBuffer->AddRef();
- rc = m_pUDPSocket->WriteTo(m_foreignAddr, m_foreignPort, pSendBuffer);
- pSendBuffer->Release();
- }
- else
- {
- rc = HXR_OUTOFMEMORY;
- }
- return rc;
-}
-
/*
* XXXMC
* Special-case handling for PV clients
@@ -1928,14 +1914,13 @@
return theErr;
}
- BYTE* pData = NULL;
- UINT32 ulLen = 0;
+ IHXBuffer* pPacketBuf = NULL;
- theErr = makePacket(pPacket, pData, ulLen);
+ theErr = makePacket(pPacket, pPacketBuf);
if (HXR_OK == theErr)
{
- theErr = writePacket(pData, ulLen);
+ theErr = writePacket(pPacketBuf);
/* send SR if necessary */
if (HXR_OK == theErr && m_pRTCPTran->m_bSendReport &&
@@ -1947,6 +1932,7 @@
}
}
+ HX_RELEASE(pPacketBuf);
return theErr;
}
@@ -2092,7 +2078,7 @@
if (HXR_OK == theErr)
{
- theErr = writePacket(pSendBuf->GetBuffer(), pSendBuf->GetSize());
+ theErr = writePacket(pSendBuf);
pSendBuf->Release();
}
else if (HXR_IGNORE == theErr)
@@ -2103,17 +2089,13 @@
return theErr;
}
- BYTE* pData = NULL;
- UINT32 ulLen = 0;
+ IHXBuffer* pPacketBuf = NULL;
- theErr = makePacket(pPacket, pData, ulLen);
+ theErr = makePacket(pPacket, pPacketBuf);
if (HXR_OK == theErr)
{
- theErr = writePacket(pData, ulLen);
- // can't delete this in :writePacket because reflector routine
- // is passing in pSendBuf->GetBuffer().
- HX_VECTOR_DELETE(pData);
+ theErr = writePacket(pPacketBuf);
/* send SR if necessary */
if (HXR_OK == theErr && m_pRTCPTran->m_bSendReport &&
@@ -2125,14 +2107,17 @@
}
}
+ HX_RELEASE(pPacketBuf);
return theErr;
}
HX_RESULT
-RTPTCPTransport::writePacket(BYTE* pData, UINT32 dataLen)
+RTPTCPTransport::writePacket(IHXBuffer* pBuf)
{
// need to put $\000[datalen] in front of packet data
+ UINT32 dataLen = pBuf->GetSize();
+
if(dataLen > 0xffff)
{
return HXR_FAIL;
@@ -2141,36 +2126,33 @@
//XXXTDM: always true, m_tcpInteleave is signed (why?)
//HX_ASSERT(0xFF != m_tcpInterleave);
- BYTE* pPacketData = new BYTE[dataLen+4];
- if(!pPacketData)
+ IHXBuffer* pHeader = NULL;
+ m_pCommonClassFactory->CreateInstance(IID_IHXBuffer,
+ (void**)&pHeader);
+ BYTE* pHeaderData;
+
+ if(!pHeader)
{
return HXR_OUTOFMEMORY;
}
- pPacketData[0] = '$';
- pPacketData[1] = m_tcpInterleave;
- putshort(&pPacketData[2], (UINT16)dataLen);
- memcpy(&pPacketData[4], pData, HX_SAFESIZE_T(dataLen)); /* Flawfinder: ignore */
- HX_RESULT rc = HXR_OK;
- CHXBuffer* pSendBuffer = new CHXBuffer;
- if(pSendBuffer)
+ pHeader->SetSize(4);
+ pHeaderData = pHeader->GetBuffer();
+
+ pHeaderData[0] = '$';
+ pHeaderData[1] = m_tcpInterleave;
+ putshort(&pHeaderData[2], (UINT16)dataLen);
+
+ HX_RESULT rc;
+ rc = m_pTCPSocket->Write(pHeader);
+ if (SUCCEEDED(rc))
{
- rc = pSendBuffer->Set(pPacketData, dataLen + 4);
- if( rc != HXR_OUTOFMEMORY )
- {
- pSendBuffer->AddRef();
- rc = m_pTCPSocket->Write(pSendBuffer);
- if(rc)
- {
- m_pResp->OnProtocolError(HXR_NET_SOCKET_INVALID);
- }
- pSendBuffer->Release();
- }
+ rc = m_pTCPSocket->Write(pBuf);
}
- else
+ if(rc)
{
- rc = HXR_OUTOFMEMORY;
+ m_pResp->OnProtocolError(HXR_NET_SOCKET_INVALID);
}
- delete[] pPacketData;
+ pHeader->Release();
return rc;
}
@@ -3491,7 +3473,7 @@
RTCPTCPTransport::reflectRTCP(IHXBuffer* pSendBuf)
{
HX_ASSERT(pSendBuf);
- HX_RESULT theErr = writePacket(pSendBuf->GetBuffer(), pSendBuf->GetSize());
+ HX_RESULT theErr = writePacket(pSendBuf);
if (theErr)
{
m_pResp->OnProtocolError(HXR_NET_SOCKET_INVALID);
@@ -3564,54 +3546,7 @@
return theErr;
}
-/*
- * if we are reflecting, there will be more than 1 AddRef on a buffer and
- * ->Set() will fail. So, need to crate a new buffer...
- */
-HX_RESULT
-RTCPTCPTransport::writePacket(BYTE* pData, UINT32 dataLen)
-{
- // need to put $\000[datalen] in front of packet data
- if(dataLen > 0xffff)
- {
- return HXR_FAIL;
- }
-
- //XXXTDM: always true, m_tcpInteleave is signed (why?)
- //HX_ASSERT(0xFF != m_tcpInterleave);
-
- HX_RESULT theErr = HXR_OK;
- CHXBuffer* pSendBuffer = new CHXBuffer;
- if(pSendBuffer)
- {
- pSendBuffer->AddRef();
- theErr = pSendBuffer->SetSize(dataLen + 4);
- if( theErr != HXR_OUTOFMEMORY )
- {
- BYTE* pc = pSendBuffer->GetBuffer();
- pc[0] = '$';
- pc[1] = m_tcpInterleave;
- putshort(&pc[2], (UINT16)dataLen);
- memcpy(&pc[4], pData, HX_SAFESIZE_T(dataLen)); /* Flawfinder: ignore */
- theErr = m_pTCPSocket->Write(pSendBuffer);
- if(theErr)
- {
- m_pResp->OnProtocolError(HXR_NET_SOCKET_INVALID);
- }
- }
- pSendBuffer->Release();
- }
- else
- {
- theErr = HXR_OUTOFMEMORY;
- }
-
- return theErr;
-}
-/*
- * there shouldn't be more than 1 addref...
- */
HX_RESULT
RTCPTCPTransport::writePacket(IHXBuffer* pBuf)
{
@@ -3627,31 +3562,29 @@
//XXXTDM: always true, m_tcpInteleave is signed (why?)
//HX_ASSERT(0xFF != m_tcpInterleave);
- /*
- * XXXGo - we should do the same as above...
- */
-
- HX_RESULT rc = HXR_OK;
- BYTE* pPacketData = new BYTE[dataLen+4];
- if(pPacketData)
- {
- pPacketData[0] = '$';
- pPacketData[1] = m_tcpInterleave;
- putshort(&pPacketData[2], (UINT16)dataLen);
- memcpy(&pPacketData[4], pBuf->GetBuffer(), HX_SAFESIZE_T(dataLen)); /* Flawfinder: ignore */
- rc = pBuf->Set(pPacketData, dataLen + 4);
- HX_ASSERT(HXR_OK == rc);
- if( rc != HXR_OUTOFMEMORY )
- {
- rc = m_pTCPSocket->Write(pBuf);
- }
+ IHXBuffer* pHeader = NULL;
+ m_pCommonClassFactory->CreateInstance(IID_IHXBuffer,
+ (void**)&pHeader);
+ BYTE* pHeaderData;
- delete[] pPacketData;
+ if(!pHeader)
+ {
+ return HXR_OUTOFMEMORY;
}
- else
+ pHeader->SetSize(4);
+ pHeaderData = pHeader->GetBuffer();
+
+ pHeaderData[0] = '$';
+ pHeaderData[1] = m_tcpInterleave;
+ putshort(&pHeaderData[2], (UINT16)dataLen);
+
+ HX_RESULT rc;
+ rc = m_pTCPSocket->Write(pHeader);
+ if (SUCCEEDED(rc))
{
- rc = HXR_OUTOFMEMORY;
+ rc = m_pTCPSocket->Write(pBuf);
}
+ pHeader->Release();
return rc;
}
Index: pub/rtptran.h
===================================================================
RCS file: /cvs/protocol/transport/rtp/pub/rtptran.h,v
retrieving revision 1.19
diff -u -r1.19 rtptran.h
--- pub/rtptran.h 15 Oct 2003 18:44:18 -0000 1.19
+++ pub/rtptran.h 20 Oct 2003 22:10:40 -0000
@@ -132,7 +132,7 @@
HX_RESULT init ();
HX_RESULT reflectPacket (BasePacket* pBasePacket, REF(IHXBuffer*)pSendBuf);
- HX_RESULT makePacket (BasePacket* pPacket, REF(BYTE*) pData, REF(UINT32) ulLen);
+ HX_RESULT makePacket (BasePacket* pPacket, REF(IHXBuffer*) pPacketBuf);
HX_RESULT handlePacket (IHXBuffer* pBuffer);
HX_RESULT handleMasterSync (ULONG32 ulHXTime, LONG32 lHXOffsetToMaster);
@@ -368,7 +368,6 @@
HX_RESULT onNATKeepAlive();
private:
- HX_RESULT writePacket (BYTE* pData, UINT32 dataLen);
HX_RESULT writePacket (IHXBuffer* pSendBuffer);
IHXUDPSocket* m_pUDPSocket;
@@ -423,7 +422,7 @@
IHXTCPSocket* m_pTCPSocket;
private:
- HX_RESULT writePacket (BYTE* pData, UINT32 dataLen);
+ HX_RESULT writePacket (IHXBuffer* pBuf);
INT8 m_tcpInterleave;
@@ -675,7 +674,6 @@
HX_RESULT sendReceiverReport ();
HX_RESULT sendBye ();
HX_RESULT writePacket (IHXBuffer* pBuf);
- HX_RESULT writePacket (BYTE* pData, UINT32 dataLen);
IHXTCPSocket* m_pTCPSocket;
INT8 m_tcpInterleave;
-------------- next part --------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
From acolwell at real.com Mon Oct 20 15:31:20 2003
From: acolwell at real.com (Aaron Colwell)
Date: Mon May 10 16:37:23 2004
Subject: [hxprotocol] CR: rtptran optimization
In-Reply-To: <200310202214.h9KMESM09733@ real.com>
Message-ID:
These look good to me.
Aaron
On Mon, 20 Oct 2003, John Mevissen wrote:
> Changes made. New diff attached.
>
> John
>
>
> On Mon, 20 Oct 2003 09:09:50 EDT,
> Eric Hyche (ehyche) writes:
> >
> >
> > John,
> >
> > If there is easy access to a context in this class, we should
> > create IHXBuffer's from the common class factory instead
> > of "new CHXBuffer".
> >
> > Eric
> >
> > At 04:39 PM 10/17/2003 -0700, John Mevissen wrote:
> >>Remove a memcpy in RTPBaseTransport::_handlePacket() by using an
> >>IHXStaticBuffer.
> >>
> >>Remove two memcpy`s in RTPTCPTransport::writePacket() by simply writing a
> >>two IHXBuffers.
> >>
> >>Since everything has to be an IHXBuffer before it gets written, I simply
> >>make makePacket() return an IHXBuffer, and got rid of the write() routines
> >>that took a char buffer and length as arguments.
> >>
> >>Image Size and Heap Use impact:
> >>Image size reduced 672 bytes (on win32)
> >>No heap impact
> >>
> >>Incoming packet functionality verified on win32, outgoing packets tested on
> >>linux.
> >>
> >>This is for the HEAD.
> >>
> >>John
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@protocol.helixcommunity.org
For additional commands, e-mail: dev-help@protocol.helixcommunity.org
Copyright © 1995-2007 RealNetworks, Inc. All rights reserved.
RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.