Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
ee31841e
Commit
ee31841e
authored
Jul 24, 2015
by
François Cartegnie
🤞
Browse files
demux: adptative: add missing remainder doing stats
parent
2ff8049f
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
View file @
ee31841e
...
...
@@ -38,7 +38,7 @@ using namespace adaptative::logic;
RateBasedAdaptationLogic
::
RateBasedAdaptationLogic
(
int
w
,
int
h
)
:
AbstractAdaptationLogic
(),
bpsAvg
(
0
),
bpsSamplecount
(
0
),
bpsAvg
(
0
),
bpsRemainder
(
0
),
bpsSamplecount
(
0
),
currentBps
(
0
)
{
width
=
w
;
...
...
@@ -68,12 +68,18 @@ void RateBasedAdaptationLogic::updateDownloadRate(size_t size, mtime_t time)
if
(
unlikely
(
time
==
0
))
return
;
size_t
current
=
size
*
8000
/
time
;
size_t
current
=
bpsRemainder
+
size
*
8000
/
time
;
if
(
current
>=
bpsAvg
)
bpsAvg
=
bpsAvg
+
(
current
-
bpsAvg
)
/
++
bpsSamplecount
;
{
bpsAvg
+=
(
current
-
bpsAvg
)
/
++
bpsSamplecount
;
bpsRemainder
=
(
current
-
bpsAvg
)
%
bpsSamplecount
;
}
else
bpsAvg
=
bpsAvg
-
(
bpsAvg
-
current
)
/
++
bpsSamplecount
;
{
bpsAvg
-=
(
bpsAvg
-
current
)
/
++
bpsSamplecount
;
bpsRemainder
=
(
bpsAvg
-
current
)
%
bpsSamplecount
;
}
cumulatedTime
+=
time
;
if
(
cumulatedTime
>
4
*
CLOCK_FREQ
/
stabilizer
)
...
...
modules/demux/adaptative/logic/RateBasedAdaptationLogic.h
View file @
ee31841e
...
...
@@ -46,6 +46,7 @@ namespace adaptative
int
width
;
int
height
;
size_t
bpsAvg
;
size_t
bpsRemainder
;
size_t
bpsSamplecount
;
size_t
currentBps
;
mtime_t
cumulatedTime
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment