|
List Info
Thread: CR-Client: FillBuffers adjustment, core and RV-FF fix
|
|
| CR-Client: FillBuffers adjustment, core
and RV-FF fix |

|
2006-08-18 01:40:53 |
Modified by: milko real.com
Date: 8:17:06
Project: PlayNow2.0
Synopsis: FillBuffers adjustment, core and RV-FF fix
Overview:
Three fixes:
1.)
The recent change in FillBuffers() routine responsible for
retrieving the
data from the local file source (IHXFileFormatObject)
utilized an algorithm
for obtaining the data from the buffers that would guarantee
success of
GetEvent call. That is, the routine would alway find at
least one packet
(event) for each stream in an optimal way as long the
processing time
required to do so was less than a system granule of 20ms.
However, the
issue arises when a very thin stream is present in the mix
in which case in
attempt to obtain a packet for a thin stream, a lot of data
was pulled in
from other streams. In order to prevent this, the
FillBuffers() process is
now limited in a manner not to accumulate more data if the
streams not yet
filled are evaluated to be more than dispatch time away from
the current
play time.
That is, if the unfilled streams after not providing a
packet immediately
on request, have no potential for needing a dispatch to a
renderer at the
instant FilBuffers is called, the FillBuffers() process is
discontinued. Potential for needing a dispatch to the
renderer takes into
account stream buffering time, system scheduling
granularity, the velocity
setting and the maximum expected inter-stream time jitter of
5 seconds.
2.)
Recent change made use of m_pRenderer field from renderer
info structure in
CheckBeginList(). This broke media nugget playback which
relies on use of
the playback engine without any renderers. Please note that
assumption the
renderer info structure contains a valid handle to the
renderer is no
longer true and that renderer pointer must be checked for
validity before
access.
3.)
Increased the number of codec allocated buffers by one to
exceed the post
decode buffer size by 4. Without this the decoder asserted
due to lacking
a buffer for a B-frame decode. We know we need 2 extra
frames in the
renderer (one for display and one frame in-transit). It
appears that one
extra frame in not sufficient for decoder to high rate of
decode. Will
need to clarify with the codec team.
Files Modified:
/client/core/hxflsrc.cpp
/client/core/hxplay.cpp
Image Size and Heap Use impact (Client -Only):
next to none
Platforms and Profiles Affected:
all
Distribution Libraries Affected:
none
Distribution library impact and planned action:
n/a
Platforms and Profiles Build Verified:
win32-i386-vc7, helix-client-all-defines
Platforms and Profiles Functionality verified:
win32-i386-vc7, helix-client-all-defines
Branch:
HEAD
Index: hxflsrc.cpp
============================================================
=======
RCS file: /cvsroot/client/core/hxflsrc.cpp,v
retrieving revision 1.104
diff -u -r1.104 hxflsrc.cpp
--- hxflsrc.cpp 17 Aug 2006 04:37:06 -0000 1.104
+++ hxflsrc.cpp 18 Aug 2006 01:16:02 -0000
 -103,7
+103,8 
#endif
#define FILEREAD_SIZE 4096
-#define LOCALSOURCE_FAST_START_BW_CAPACITY_THRESHOLD 150 //
A percentage
of source bitrate
+#define LOCALSOURCE_FAST_START_BW_CAPACITY_THRESHOLD 150 //
A percentage
of source
bitrate
+#define MAX_INTERSTREAM_TIMESTAMP_JITTER 5000 // In
milliseconds
HXFileSource::HXFileSource()
: m_lRefCount(0)
 -3047,7
+3048,7 
{
return HXR_OK;
}
-
+
UINT32 ulNow = HX_GET_BETTERTICKCOUNT();
while (SUCCEEDED(retVal) &&
SelectNextStreamToFill(lpStreamInfo))
{
 -3091,8
+3092,11 
{
STREAM_INFO* lpStreamInfo = NULL;
UINT32 ulMinTS;
+ INT32 lVelocity = m_pPlayer->GetVelocity();
+ UINT32 ulEmptyStreamsMaxBufferingInMs = 0;
HXBOOL bMinTSSet = FALSE;
HXBOOL bSelectedStream = FALSE;
+ HXBOOL bSelectedEmptyStream = FALSE;
HXBOOL bHasUnfilledStreams = FALSE;
CHXMapLongToObj::Iterator ndxStream =
mStreamInfoTable->Begin();
 -3106,6
+3110,11 
if (lpStreamInfo->m_EventList.GetNumEvents() == 0)
{
bHasUnfilledStreams = TRUE;
+
+ if (ulEmptyStreamsMaxBufferingInMs <
lpStreamInfo->BufferingState().GetMinBufferingInMs())
+ {
+ ulEmptyStreamsMaxBufferingInMs =
lpStreamInfo->BufferingState().GetMinBufferingInMs();
+ }
}
if (!lpStreamInfo->m_bPacketRequested)
 -3114,6
+3123,7 
{
lpStreamInfoOut = lpStreamInfo;
bSelectedStream = TRUE;
+ bSelectedEmptyStream = TRUE;
break;
}
else
 -3122,7
+3132,8 
if (bMinTSSet)
{
- if (((LONG32) (ulMinTS - ulTS)) > 0)
+ LONG32 lTSDelta = (LONG32) ((lVelocity >= 0) ?
(ulMinTS - ulTS) : (ulTS
- ulMinTS));
+ if (lTSDelta > 0)
{
lpStreamInfoOut = lpStreamInfo;
ulMinTS = ulTS;
 -3141,6
+3152,57 
}
}
+ if (bHasUnfilledStreams && bSelectedStream
&& (!bSelectedEmptyStream))
+ {
+ // We need to make sure we do not select streams to be
filled too far
+ // ahead of time and thus loading too much data and into
RAM and
+ // spinning for longer than neeed.
+ // This can occur when one of the streams is very sparse
+ // (e.g. event stream with events possibly hours apart)
and we are
+ // unsable to fill the buffer for it without filling the
buffers
+ // of all other streams excessively.
+ // Thus, when we select a non-empty stream over an empty
one,
+ // we check that the minimum renderer dispatch time of the
empty stream is
+ // ahead of where the play-time currently is and if so we
do
+ // not select the stream to fill.
+
+ // We are computing rendering time from the renderer
dispatch time below by
+ // subtracting the minimum buffering time.
+ // We skip doing this for time 0 since at time 0 we are
not sure which
portion
+ // of the buffering time for the stream has been
subtracted from
+ // the rendering time since the dispatch time is not
allowed to go negative.
+ // this is not an issue since we'll error on a
conservative side.
+ UINT32 ulMinEmptyStreamsTime =
+ lpStreamInfoOut->m_EventList.GetTail()->GetTimeStar
tPos();
+ if (ulMinEmptyStreamsTime != 0)
+ {
+ ulMinEmptyStreamsTime +=
lpStreamInfoOut->BufferingState().GetMinBufferingInMs();
+ }
+
+ UINT32 ulEmptyStreamsMaxRendererDispatchTime =
m_pPlayer->ComputeFillEndTime(
+ m_pPlayer->GetInternalCurrentPlayTime(),
+ m_pPlayer->GetGranularity(),
+ ulEmptyStreamsMaxBufferingInMs +
MAX_INTERSTREAM_TIMESTAMP_JITTER);
+
+ INT32 lMinEmptyStreamsAheadOfDispatchTime =
+ ((LONG32) (ulMinEmptyStreamsTime -
ulEmptyStreamsMaxRendererDispatchTime));
+
+ if (lVelocity >= 0)
+ {
+ if (lMinEmptyStreamsAheadOfDispatchTime > 0)
+ {
+ bSelectedStream = FALSE;
+ }
+ }
+ else
+ {
+ if (lMinEmptyStreamsAheadOfDispatchTime < 0)
+ {
+ bSelectedStream = FALSE;
+ }
+ }
+ }
+
return (bSelectedStream &&
bHasUnfilledStreams);
}
Index: hxplay.cpp
============================================================
=======
RCS file: /cvsroot/client/core/hxplay.cpp,v
retrieving revision 1.152
diff -u -r1.152 hxplay.cpp
--- hxplay.cpp 17 Aug 2006 04:37:06 -0000 1.152
+++ hxplay.cpp 18 Aug 2006 01:16:03 -0000
 -9241,7
+9241,10 
if (HXR_OK == rcTemp)
{
pRendInfo->m_bInitialBeginToBeSent =
FALSE;
-
pRendInfo->m_pRenderer->OnBegin(ulOnBeginTime);
+ if (pRendInfo->m_pRenderer)
+ {
+ pRendInfo->m_pRenderer->OnBegin(ulOnBeginTime);
+ }
lPos =
m_ToBeginRendererList.RemoveAt(lPos);
}
else
Index: rvxvdec.cpp
============================================================
=======
RCS file: /cvsroot/datatype/rm/video/renderer/rvxvdec.cpp,v
retrieving revision 1.20
diff -u -r1.20 rvxvdec.cpp
--- rvxvdec.cpp 21 Jul 2006 20:22:43 -0000 1.20
+++ rvxvdec.cpp 18 Aug 2006 01:25:27 -0000
 -296,7
+296,7 
if (bAttemptDistributedMode)
{
- UINT32 ulDecodeQueueDepth =
m_pVideoFormat->m_ulMaxDecodedFrames + 3;
+ UINT32 ulDecodeQueueDepth =
m_pVideoFormat->m_ulMaxDecodedFrames + 4;
if
(SUCCEEDED(m_pCodecLib->PNStream_SetProperty(m_pStream,
SP_HW_VIDEO_MEMORY,
(void*) &ulDecodeQueueDepth)))
_______________________________________________
Helix-client-dev mailing list
Helix-client-dev helixcommunity.org
http://lists.helixcommunity.org/mailman/listinf
o/helix-client-dev
|
|
| CR-Client: FillBuffers adjustment, core
and RV-FF fix |

|
2006-08-18 01:59:28 |
Milko Boic wrote:
> Modified by: milko real.com
> Date: 8:17:06
> Project: PlayNow2.0
>
> Synopsis: FillBuffers adjustment, core and RV-FF fix
>
> Overview:
> Three fixes:
> 1.)
> The recent change in FillBuffers() routine responsible
for retrieving
> the data from the local file source
(IHXFileFormatObject) utilized an
> algorithm for obtaining the data from the buffers that
would guarantee
> success of GetEvent call. That is, the routine would
alway find at
> least one packet (event) for each stream in an optimal
way as long the
> processing time required to do so was less than a
system granule of
> 20ms. However, the issue arises when a very thin
stream is present in
> the mix in which case in attempt to obtain a packet for
a thin stream, a
> lot of data was pulled in from other streams. In order
to prevent this,
> the FillBuffers() process is now limited in a manner
not to accumulate
> more data if the streams not yet filled are evaluated
to be more than
> dispatch time away from the current play time.
> That is, if the unfilled streams after not providing a
packet
> immediately on request, have no potential for needing a
dispatch to a
> renderer at the instant FilBuffers is called, the
FillBuffers() process
> is discontinued. Potential for needing a dispatch to
the renderer takes
> into account stream buffering time, system scheduling
granularity, the
> velocity setting and the maximum expected inter-stream
time jitter of 5
> seconds.
>
> 2.)
> Recent change made use of m_pRenderer field from
renderer info structure
> in CheckBeginList(). This broke media nugget playback
which relies on
> use of the playback engine without any renderers.
Please note that
> assumption the renderer info structure contains a valid
handle to the
> renderer is no longer true and that renderer pointer
must be checked for
> validity before access.
>
> 3.)
> Increased the number of codec allocated buffers by one
to exceed the
> post decode buffer size by 4. Without this the decoder
asserted due to
> lacking a buffer for a B-frame decode. We know we need
2 extra frames
> in the renderer (one for display and one frame
in-transit). It appears
> that one extra frame in not sufficient for decoder to
high rate of
> decode. Will need to clarify with the codec team.
>
>
> Files Modified:
> /client/core/hxflsrc.cpp
> /client/core/hxplay.cpp
>
> Image Size and Heap Use impact (Client -Only):
> next to none
>
> Platforms and Profiles Affected:
> all
>
> Distribution Libraries Affected:
> none
>
> Distribution library impact and planned action:
> n/a
>
> Platforms and Profiles Build Verified:
> win32-i386-vc7, helix-client-all-defines
>
> Platforms and Profiles Functionality verified:
> win32-i386-vc7, helix-client-all-defines
>
> Branch:
> HEAD
>
>
> Index: hxflsrc.cpp
>
============================================================
=======
> RCS file: /cvsroot/client/core/hxflsrc.cpp,v
> retrieving revision 1.104
> diff -u -r1.104 hxflsrc.cpp
> --- hxflsrc.cpp 17 Aug 2006 04:37:06 -0000 1.104
> +++ hxflsrc.cpp 18 Aug 2006 01:16:02 -0000
>  -103,7 +103,8 
> #endif
>
> #define FILEREAD_SIZE 4096
> -#define LOCALSOURCE_FAST_START_BW_CAPACITY_THRESHOLD
150 // A percentage of source bitrate
> +#define LOCALSOURCE_FAST_START_BW_CAPACITY_THRESHOLD
150 // A percentage of source bitrate
> +#define MAX_INTERSTREAM_TIMESTAMP_JITTER 5000
// In milliseconds
>
> HXFileSource::HXFileSource()
> : m_lRefCount(0)
>  -3047,7 +3048,7 
> {
> return HXR_OK;
> }
> -
> +
> UINT32 ulNow = HX_GET_BETTERTICKCOUNT();
> while (SUCCEEDED(retVal) &&
SelectNextStreamToFill(lpStreamInfo))
> {
>  -3091,8 +3092,11 
> {
> STREAM_INFO* lpStreamInfo = NULL;
> UINT32 ulMinTS;
> + INT32 lVelocity = m_pPlayer->GetVelocity();
> + UINT32 ulEmptyStreamsMaxBufferingInMs = 0;
> HXBOOL bMinTSSet = FALSE;
> HXBOOL bSelectedStream = FALSE;
> + HXBOOL bSelectedEmptyStream = FALSE;
> HXBOOL bHasUnfilledStreams = FALSE;
>
> CHXMapLongToObj::Iterator ndxStream =
mStreamInfoTable->Begin();
>  -3106,6 +3110,11 
> if
(lpStreamInfo->m_EventList.GetNumEvents() == 0)
> {
> bHasUnfilledStreams = TRUE;
> +
> + if (ulEmptyStreamsMaxBufferingInMs <
lpStreamInfo->BufferingState().GetMinBufferingInMs())
> + {
> + ulEmptyStreamsMaxBufferingInMs =
lpStreamInfo->BufferingState().GetMinBufferingInMs();
> + }
> }
>
> if (!lpStreamInfo->m_bPacketRequested)
>  -3114,6 +3123,7 
> {
> lpStreamInfoOut = lpStreamInfo;
> bSelectedStream = TRUE;
> + bSelectedEmptyStream = TRUE;
> break;
> }
> else
>  -3122,7 +3132,8 
>
> if (bMinTSSet)
> {
> - if (((LONG32) (ulMinTS - ulTS)) > 0)
> + LONG32 lTSDelta = (LONG32) ((lVelocity
>= 0) ? (ulMinTS - ulTS) : (ulTS - ulMinTS));
Not a big deal, but I think we are going to deprecate *LONG*
types in favor of the *INT* type (INT32, UINT32). We will
catch
this either way when we get around to doing the automated
search
and replace scripts though.
> + if (lTSDelta > 0)
> {
> lpStreamInfoOut = lpStreamInfo;
> ulMinTS = ulTS;
>  -3141,6 +3152,57 
> }
> }
>
> + if (bHasUnfilledStreams && bSelectedStream
&& (!bSelectedEmptyStream))
> + {
> + // We need to make sure we do not select streams
to be filled too far
> + // ahead of time and thus loading too much data
and into RAM and
> + // spinning for longer than neeed.
> + // This can occur when one of the streams is very
sparse
> + // (e.g. event stream with events possibly hours
apart) and we are
> + // unsable to fill the buffer for it without
filling the buffers
unsable -> unable.
rest looks good.
--greg.
> + // of all other streams excessively.
> + // Thus, when we select a non-empty stream over an
empty one,
> + // we check that the minimum renderer dispatch
time of the empty
> stream is
> + // ahead of where the play-time currently is and
if so we do
> + // not select the stream to fill.
> +
> + // We are computing rendering time from the
renderer dispatch time
> below by
> + // subtracting the minimum buffering time.
> + // We skip doing this for time 0 since at time 0
we are not sure
> which portion
> + // of the buffering time for the stream has been
subtracted from
> + // the rendering time since the dispatch time is
not allowed to go
> negative.
> + // this is not an issue since we'll error on a
conservative side.
> + UINT32 ulMinEmptyStreamsTime =
> +
lpStreamInfoOut->m_EventList.GetTail()->GetTimeStartPo
s();
> + if (ulMinEmptyStreamsTime != 0)
> + {
> + ulMinEmptyStreamsTime +=
>
lpStreamInfoOut->BufferingState().GetMinBufferingInMs();
> + }
> +
> + UINT32 ulEmptyStreamsMaxRendererDispatchTime =
> m_pPlayer->ComputeFillEndTime(
> +
m_pPlayer->GetInternalCurrentPlayTime(),
> + m_pPlayer->GetGranularity(),
> + ulEmptyStreamsMaxBufferingInMs +
> MAX_INTERSTREAM_TIMESTAMP_JITTER);
> +
> + INT32 lMinEmptyStreamsAheadOfDispatchTime =
> + ((LONG32) (ulMinEmptyStreamsTime -
> ulEmptyStreamsMaxRendererDispatchTime));
> +
> + if (lVelocity >= 0)
> + {
> + if (lMinEmptyStreamsAheadOfDispatchTime >
0)
> + {
> + bSelectedStream = FALSE;
> + }
> + }
> + else
> + {
> + if (lMinEmptyStreamsAheadOfDispatchTime <
0)
> + {
> + bSelectedStream = FALSE;
> + }
> + }
> + }
> +
> return (bSelectedStream &&
bHasUnfilledStreams);
> }
>
> Index: hxplay.cpp
>
============================================================
=======
> RCS file: /cvsroot/client/core/hxplay.cpp,v
> retrieving revision 1.152
> diff -u -r1.152 hxplay.cpp
> --- hxplay.cpp 17 Aug 2006 04:37:06 -0000 1.152
> +++ hxplay.cpp 18 Aug 2006 01:16:03 -0000
>  -9241,7 +9241,10 
> if (HXR_OK == rcTemp)
> {
> pRendInfo->m_bInitialBeginToBeSent
= FALSE;
> -
pRendInfo->m_pRenderer->OnBegin(ulOnBeginTime);
> + if (pRendInfo->m_pRenderer)
> + {
> +
pRendInfo->m_pRenderer->OnBegin(ulOnBeginTime);
> + }
> lPos =
m_ToBeginRendererList.RemoveAt(lPos);
> }
> else
>
> Index: rvxvdec.cpp
>
============================================================
=======
> RCS file:
/cvsroot/datatype/rm/video/renderer/rvxvdec.cpp,v
> retrieving revision 1.20
> diff -u -r1.20 rvxvdec.cpp
> --- rvxvdec.cpp 21 Jul 2006 20:22:43 -0000 1.20
> +++ rvxvdec.cpp 18 Aug 2006 01:25:27 -0000
>  -296,7 +296,7 
>
> if (bAttemptDistributedMode)
> {
> - UINT32 ulDecodeQueueDepth =
> m_pVideoFormat->m_ulMaxDecodedFrames + 3;
> + UINT32 ulDecodeQueueDepth =
> m_pVideoFormat->m_ulMaxDecodedFrames + 4;
> if
(SUCCEEDED(m_pCodecLib->PNStream_SetProperty(m_pStream,
> SP_HW_VIDEO_MEMORY,
> (void*)
&ulDecodeQueueDepth)))
>
>
> _______________________________________________
> Helix-client-dev mailing list
> Helix-client-dev helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinf
o/helix-client-dev
>
_______________________________________________
Helix-client-dev mailing list
Helix-client-dev helixcommunity.org
http://lists.helixcommunity.org/mailman/listinf
o/helix-client-dev
|
|
[1-2]
|
|