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
4497a587
Commit
4497a587
authored
Nov 07, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: account and split bandwidth usage
parent
62cbf970
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
12 deletions
+36
-12
modules/demux/adaptative/SegmentTracker.cpp
modules/demux/adaptative/SegmentTracker.cpp
+1
-0
modules/demux/adaptative/logic/AbstractAdaptationLogic.h
modules/demux/adaptative/logic/AbstractAdaptationLogic.h
+5
-2
modules/demux/adaptative/logic/AlwaysBestAdaptationLogic.cpp
modules/demux/adaptative/logic/AlwaysBestAdaptationLogic.cpp
+1
-1
modules/demux/adaptative/logic/AlwaysBestAdaptationLogic.h
modules/demux/adaptative/logic/AlwaysBestAdaptationLogic.h
+1
-1
modules/demux/adaptative/logic/AlwaysLowestAdaptationLogic.cpp
...es/demux/adaptative/logic/AlwaysLowestAdaptationLogic.cpp
+1
-1
modules/demux/adaptative/logic/AlwaysLowestAdaptationLogic.hpp
...es/demux/adaptative/logic/AlwaysLowestAdaptationLogic.hpp
+1
-1
modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
+21
-3
modules/demux/adaptative/logic/RateBasedAdaptationLogic.h
modules/demux/adaptative/logic/RateBasedAdaptationLogic.h
+5
-3
No files found.
modules/demux/adaptative/SegmentTracker.cpp
View file @
4497a587
...
...
@@ -60,6 +60,7 @@ SegmentTracker::~SegmentTracker()
void
SegmentTracker
::
setAdaptationLogic
(
AbstractAdaptationLogic
*
logic_
)
{
logic
=
logic_
;
registerListener
(
logic
);
}
void
SegmentTracker
::
reset
()
...
...
modules/demux/adaptative/logic/AbstractAdaptationLogic.h
View file @
4497a587
...
...
@@ -26,6 +26,7 @@
#define ABSTRACTADAPTATIONLOGIC_H_
#include "IDownloadRateObserver.h"
#include "../SegmentTracker.hpp"
namespace
adaptative
{
...
...
@@ -39,14 +40,16 @@ namespace adaptative
{
using
namespace
playlist
;
class
AbstractAdaptationLogic
:
public
IDownloadRateObserver
class
AbstractAdaptationLogic
:
public
IDownloadRateObserver
,
public
SegmentTrackerListenerInterface
{
public:
AbstractAdaptationLogic
();
virtual
~
AbstractAdaptationLogic
();
virtual
BaseRepresentation
*
get
CurrentRepresentation
(
BaseAdaptationSet
*
)
const
=
0
;
virtual
BaseRepresentation
*
get
NextRepresentation
(
BaseAdaptationSet
*
,
BaseRepresentation
*
)
const
=
0
;
virtual
void
updateDownloadRate
(
size_t
,
mtime_t
);
virtual
void
trackerEvent
(
const
SegmentTrackerEvent
&
)
{}
enum
LogicType
{
...
...
modules/demux/adaptative/logic/AlwaysBestAdaptationLogic.cpp
View file @
4497a587
...
...
@@ -36,7 +36,7 @@ AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic () :
{
}
BaseRepresentation
*
AlwaysBestAdaptationLogic
::
get
CurrentRepresentation
(
BaseAdaptationSet
*
adaptSet
)
const
BaseRepresentation
*
AlwaysBestAdaptationLogic
::
get
NextRepresentation
(
BaseAdaptationSet
*
adaptSet
,
BaseRepresentation
*
)
const
{
RepresentationSelector
selector
;
return
selector
.
select
(
adaptSet
);
...
...
modules/demux/adaptative/logic/AlwaysBestAdaptationLogic.h
View file @
4497a587
...
...
@@ -36,7 +36,7 @@ namespace adaptative
public:
AlwaysBestAdaptationLogic
();
virtual
BaseRepresentation
*
get
CurrentRepresentation
(
BaseAdaptationSet
*
)
const
;
virtual
BaseRepresentation
*
get
NextRepresentation
(
BaseAdaptationSet
*
,
BaseRepresentation
*
)
const
;
};
}
}
...
...
modules/demux/adaptative/logic/AlwaysLowestAdaptationLogic.cpp
View file @
4497a587
...
...
@@ -28,7 +28,7 @@ AlwaysLowestAdaptationLogic::AlwaysLowestAdaptationLogic():
{
}
BaseRepresentation
*
AlwaysLowestAdaptationLogic
::
get
CurrentRepresentation
(
BaseAdaptationSet
*
adaptSet
)
const
BaseRepresentation
*
AlwaysLowestAdaptationLogic
::
get
NextRepresentation
(
BaseAdaptationSet
*
adaptSet
,
BaseRepresentation
*
)
const
{
RepresentationSelector
selector
;
return
selector
.
select
(
adaptSet
,
0
);
...
...
modules/demux/adaptative/logic/AlwaysLowestAdaptationLogic.hpp
View file @
4497a587
...
...
@@ -31,7 +31,7 @@ namespace adaptative
public:
AlwaysLowestAdaptationLogic
();
virtual
BaseRepresentation
*
get
CurrentRepresentation
(
BaseAdaptationSet
*
)
const
;
virtual
BaseRepresentation
*
get
NextRepresentation
(
BaseAdaptationSet
*
,
BaseRepresentation
*
)
const
;
};
}
}
...
...
modules/demux/adaptative/logic/RateBasedAdaptationLogic.cpp
View file @
4497a587
...
...
@@ -40,15 +40,22 @@ RateBasedAdaptationLogic::RateBasedAdaptationLogic (int w, int h) :
{
width
=
w
;
height
=
h
;
usedBps
=
0
;
}
BaseRepresentation
*
RateBasedAdaptationLogic
::
get
CurrentRepresentation
(
BaseAdaptationSet
*
adaptSet
)
const
BaseRepresentation
*
RateBasedAdaptationLogic
::
get
NextRepresentation
(
BaseAdaptationSet
*
adaptSet
,
BaseRepresentation
*
currep
)
const
{
if
(
adaptSet
==
NULL
)
return
NULL
;
size_t
availBps
=
currentBps
+
((
currep
)
?
currep
->
getBandwidth
()
:
0
);
if
(
availBps
>
usedBps
)
availBps
-=
usedBps
;
else
availBps
=
0
;
RepresentationSelector
selector
;
BaseRepresentation
*
rep
=
selector
.
select
(
adaptSet
,
current
Bps
,
width
,
height
);
BaseRepresentation
*
rep
=
selector
.
select
(
adaptSet
,
avail
Bps
,
width
,
height
);
if
(
rep
==
NULL
)
{
rep
=
selector
.
select
(
adaptSet
);
...
...
@@ -79,13 +86,24 @@ void RateBasedAdaptationLogic::updateDownloadRate(size_t size, mtime_t time)
currentBps
=
bpsAvg
*
3
/
4
;
}
void
RateBasedAdaptationLogic
::
trackerEvent
(
const
SegmentTrackerEvent
&
event
)
{
if
(
event
.
type
==
SegmentTrackerEvent
::
SWITCHING
)
{
if
(
event
.
u
.
switching
.
prev
)
usedBps
-=
event
.
u
.
switching
.
prev
->
getBandwidth
();
if
(
event
.
u
.
switching
.
next
)
usedBps
+=
event
.
u
.
switching
.
next
->
getBandwidth
();
}
}
FixedRateAdaptationLogic
::
FixedRateAdaptationLogic
(
size_t
bps
)
:
AbstractAdaptationLogic
()
{
currentBps
=
bps
;
}
BaseRepresentation
*
FixedRateAdaptationLogic
::
get
CurrentRepresentation
(
BaseAdaptationSet
*
adaptSet
)
const
BaseRepresentation
*
FixedRateAdaptationLogic
::
get
NextRepresentation
(
BaseAdaptationSet
*
adaptSet
,
BaseRepresentation
*
)
const
{
if
(
adaptSet
==
NULL
)
return
NULL
;
...
...
modules/demux/adaptative/logic/RateBasedAdaptationLogic.h
View file @
4497a587
...
...
@@ -39,8 +39,9 @@ namespace adaptative
public:
RateBasedAdaptationLogic
(
int
,
int
);
BaseRepresentation
*
getCurrentRepresentation
(
BaseAdaptationSet
*
)
const
;
virtual
void
updateDownloadRate
(
size_t
,
mtime_t
);
BaseRepresentation
*
getNextRepresentation
(
BaseAdaptationSet
*
,
BaseRepresentation
*
)
const
;
virtual
void
updateDownloadRate
(
size_t
,
mtime_t
);
/* reimpl */
virtual
void
trackerEvent
(
const
SegmentTrackerEvent
&
);
/* reimpl */
private:
int
width
;
...
...
@@ -49,6 +50,7 @@ namespace adaptative
size_t
bpsRemainder
;
size_t
bpsSamplecount
;
size_t
currentBps
;
size_t
usedBps
;
};
class
FixedRateAdaptationLogic
:
public
AbstractAdaptationLogic
...
...
@@ -56,7 +58,7 @@ namespace adaptative
public:
FixedRateAdaptationLogic
(
size_t
);
BaseRepresentation
*
get
CurrentRepresentation
(
BaseAdaptationSet
*
)
const
;
BaseRepresentation
*
get
NextRepresentation
(
BaseAdaptationSet
*
,
BaseRepresentation
*
)
const
;
private:
size_t
currentBps
;
...
...
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