Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
63506d5a
Commit
63506d5a
authored
Jun 17, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add inertia to rate based logic
parent
bbf89a9f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
+21
-5
modules/demux/adaptative/logic/RateBasedAdaptationLogic.h
modules/demux/adaptative/logic/RateBasedAdaptationLogic.h
+2
-0
No files found.
modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
View file @
63506d5a
...
...
@@ -21,6 +21,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#define __STDC_CONSTANT_MACROS
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
...
...
@@ -40,6 +43,8 @@ RateBasedAdaptationLogic::RateBasedAdaptationLogic (int w, int h) :
{
width
=
w
;
height
=
h
;
cumulatedTime
=
0
;
stabilizer
=
16
;
}
BaseRepresentation
*
RateBasedAdaptationLogic
::
getCurrentRepresentation
(
StreamType
type
,
BasePeriod
*
period
)
const
...
...
@@ -66,14 +71,25 @@ void RateBasedAdaptationLogic::updateDownloadRate(size_t size, mtime_t time)
size_t
current
=
size
*
8000
/
time
;
if
(
current
>=
bpsAvg
)
bpsAvg
=
bpsAvg
+
(
current
-
bpsAvg
)
/
(
bpsSamplecount
+
1
)
;
bpsAvg
=
bpsAvg
+
(
current
-
bpsAvg
)
/
++
bpsSamplecount
;
else
bpsAvg
=
bpsAvg
-
(
bpsAvg
-
current
)
/
(
bpsSamplecount
+
1
)
;
bpsAvg
=
bpsAvg
-
(
bpsAvg
-
current
)
/
++
bpsSamplecount
;
bpsSamplecount
++
;
cumulatedTime
+=
time
;
if
(
cumulatedTime
>
4
*
CLOCK_FREQ
/
stabilizer
)
{
if
(
currentBps
<=
bpsAvg
*
3
/
4
&&
stabilizer
<
16
)
{
stabilizer
++
;
}
else
if
(
currentBps
>
bpsAvg
*
3
/
4
&&
stabilizer
>
1
)
{
stabilizer
/=
2
;
}
if
(
bpsSamplecount
%
5
==
0
)
currentBps
=
bpsAvg
;
currentBps
=
bpsAvg
*
3
/
4
;
cumulatedTime
=
0
;
}
}
FixedRateAdaptationLogic
::
FixedRateAdaptationLogic
(
size_t
bps
)
:
...
...
modules/demux/adaptative/logic/RateBasedAdaptationLogic.h
View file @
63506d5a
...
...
@@ -48,6 +48,8 @@ namespace adaptative
size_t
bpsAvg
;
size_t
bpsSamplecount
;
size_t
currentBps
;
mtime_t
cumulatedTime
;
int
stabilizer
;
};
class
FixedRateAdaptationLogic
:
public
AbstractAdaptationLogic
...
...
Write
Preview
Markdown
is supported
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