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
890887de
Commit
890887de
authored
Nov 18, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream_filter: dash: move representation selection into logic
parent
eb2d6145
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
181 additions
and
99 deletions
+181
-99
modules/stream_filter/Makefile.am
modules/stream_filter/Makefile.am
+2
-0
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
...filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
+10
-8
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
...m_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
+1
-0
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
..._filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
+19
-12
modules/stream_filter/dash/adaptationlogic/Representationselectors.cpp
...m_filter/dash/adaptationlogic/Representationselectors.cpp
+97
-0
modules/stream_filter/dash/adaptationlogic/Representationselectors.hpp
...m_filter/dash/adaptationlogic/Representationselectors.hpp
+49
-0
modules/stream_filter/dash/mpd/BasicCMManager.cpp
modules/stream_filter/dash/mpd/BasicCMManager.cpp
+0
-5
modules/stream_filter/dash/mpd/BasicCMManager.h
modules/stream_filter/dash/mpd/BasicCMManager.h
+0
-2
modules/stream_filter/dash/mpd/IMPDManager.cpp
modules/stream_filter/dash/mpd/IMPDManager.cpp
+0
-32
modules/stream_filter/dash/mpd/IMPDManager.h
modules/stream_filter/dash/mpd/IMPDManager.h
+1
-4
modules/stream_filter/dash/mpd/IsoffMainManager.cpp
modules/stream_filter/dash/mpd/IsoffMainManager.cpp
+2
-34
modules/stream_filter/dash/mpd/IsoffMainManager.h
modules/stream_filter/dash/mpd/IsoffMainManager.h
+0
-2
No files found.
modules/stream_filter/Makefile.am
View file @
890887de
...
...
@@ -19,6 +19,8 @@ libdash_plugin_la_SOURCES = \
stream_filter/dash/adaptationlogic/IDownloadRateObserver.h
\
stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
\
stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
\
stream_filter/dash/adaptationlogic/Representationselectors.hpp
\
stream_filter/dash/adaptationlogic/Representationselectors.cpp
\
stream_filter/dash/buffer/BlockBuffer.cpp
\
stream_filter/dash/buffer/BlockBuffer.h
\
stream_filter/dash/buffer/IBufferObserver.h
\
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
View file @
890887de
...
...
@@ -70,20 +70,22 @@ const Representation *AlwaysBestAdaptationLogic::getCurrentRepresentation() cons
void
AlwaysBestAdaptationLogic
::
initSchedule
()
{
if
(
this
->
mpdManager
!=
NULL
)
if
(
mpdManager
)
{
std
::
vector
<
Period
*>
periods
=
this
->
mpdManager
->
getPeriods
();
std
::
vector
<
Period
*>
periods
=
mpdManager
->
getPeriods
();
std
::
vector
<
Period
*>::
const_iterator
it
;
RepresentationSelector
selector
;
for
(
size_t
i
=
0
;
i
<
periods
.
size
();
i
++
)
for
(
it
=
periods
.
begin
();
it
!=
periods
.
end
();
it
++
)
{
Representation
*
best
=
this
->
mpdManager
->
getBestRepresentation
(
periods
.
at
(
i
));
if
(
best
!=
NULL
)
Representation
*
best
=
selector
.
select
(
*
it
);
if
(
best
)
{
std
::
vector
<
Segment
*>
segments
=
best
->
getSegments
();
for
(
size_t
j
=
0
;
j
<
segments
.
size
();
j
++
)
std
::
vector
<
Segment
*>::
const_iterator
segIt
;
for
(
segIt
=
segments
.
begin
();
segIt
!=
segments
.
end
();
segIt
++
)
{
this
->
schedule
.
push_back
(
segments
.
at
(
j
)
);
schedule
.
push_back
(
*
segIt
);
}
}
}
...
...
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
View file @
890887de
...
...
@@ -26,6 +26,7 @@
#define ALWAYSBESTADAPTATIONLOGIC_H_
#include "adaptationlogic/AbstractAdaptationLogic.h"
#include "Representationselectors.hpp"
#include "http/Chunk.h"
#include "xml/Node.h"
#include "mpd/IMPDManager.h"
...
...
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
View file @
890887de
...
...
@@ -26,6 +26,7 @@
#endif
#include "RateBasedAdaptationLogic.h"
#include "Representationselectors.hpp"
using
namespace
dash
::
logic
;
using
namespace
dash
::
xml
;
...
...
@@ -46,20 +47,11 @@ RateBasedAdaptationLogic::RateBasedAdaptationLogic (IMPDManager *mpdManager, st
Chunk
*
RateBasedAdaptationLogic
::
getNextChunk
()
{
if
(
this
->
mpdManager
==
NULL
)
return
NULL
;
if
(
this
->
currentPeriod
==
NULL
)
return
NULL
;
uint64_t
bitrate
=
this
->
getBpsAvg
();
if
(
this
->
getBufferPercent
()
<
MINBUFFER
)
bitrate
=
0
;
Representation
*
rep
=
this
->
mpdManager
->
getRepresentation
(
this
->
currentPeriod
,
bitrate
,
this
->
width
,
this
->
height
);
if
(
rep
==
NULL
)
const
Representation
*
rep
=
getCurrentRepresentation
();
if
(
!
rep
)
return
NULL
;
std
::
vector
<
Segment
*>
segments
=
rep
->
getSegments
();
...
...
@@ -86,5 +78,20 @@ Chunk* RateBasedAdaptationLogic::getNextChunk()
const
Representation
*
RateBasedAdaptationLogic
::
getCurrentRepresentation
()
const
{
return
this
->
mpdManager
->
getRepresentation
(
this
->
currentPeriod
,
this
->
getBpsAvg
()
);
if
(
currentPeriod
==
NULL
)
return
NULL
;
uint64_t
bitrate
=
this
->
getBpsAvg
();
if
(
getBufferPercent
()
<
MINBUFFER
)
bitrate
=
0
;
RepresentationSelector
selector
;
Representation
*
rep
=
selector
.
select
(
currentPeriod
,
bitrate
,
width
,
height
);
if
(
rep
==
NULL
)
{
rep
=
selector
.
select
(
currentPeriod
);
if
(
rep
==
NULL
)
return
NULL
;
}
return
rep
;
}
modules/stream_filter/dash/adaptationlogic/Representationselectors.cpp
0 → 100644
View file @
890887de
/*
* Representationselectors.cpp
*****************************************************************************
* Copyright (C) 2014 - VideoLAN authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "Representationselectors.hpp"
#include <limits>
using
namespace
dash
::
logic
;
RepresentationSelector
::
RepresentationSelector
()
{
}
Representation
*
RepresentationSelector
::
select
(
Period
*
period
)
const
{
return
select
(
period
,
std
::
numeric_limits
<
uint64_t
>::
max
());
}
Representation
*
RepresentationSelector
::
select
(
Period
*
period
,
uint64_t
bitrate
)
const
{
if
(
period
==
NULL
)
return
NULL
;
std
::
vector
<
AdaptationSet
*>
adaptSets
=
period
->
getAdaptationSets
();
Representation
*
best
=
NULL
;
std
::
vector
<
AdaptationSet
*>::
const_iterator
adaptIt
;
for
(
adaptIt
=
adaptSets
.
begin
();
adaptIt
!=
adaptSets
.
end
();
adaptIt
++
)
{
std
::
vector
<
Representation
*>
reps
=
(
*
adaptIt
)
->
getRepresentations
();
Representation
*
candidate
=
select
(
reps
,
(
best
)
?
best
->
getBandwidth
()
:
0
,
bitrate
);
if
(
candidate
)
best
=
candidate
;
}
return
best
;
}
Representation
*
RepresentationSelector
::
select
(
Period
*
period
,
uint64_t
bitrate
,
int
width
,
int
height
)
const
{
if
(
period
==
NULL
)
return
NULL
;
std
::
vector
<
Representation
*>
resMatchReps
;
/* subset matching WxH */
std
::
vector
<
AdaptationSet
*>
adaptSets
=
period
->
getAdaptationSets
();
std
::
vector
<
AdaptationSet
*>::
const_iterator
adaptIt
;
for
(
adaptIt
=
adaptSets
.
begin
();
adaptIt
!=
adaptSets
.
end
();
adaptIt
++
)
{
std
::
vector
<
Representation
*>
reps
=
(
*
adaptIt
)
->
getRepresentations
();
std
::
vector
<
Representation
*>::
const_iterator
repIt
;
for
(
repIt
=
reps
.
begin
();
repIt
!=
reps
.
end
();
repIt
++
)
{
if
((
*
repIt
)
->
getWidth
()
==
width
&&
(
*
repIt
)
->
getHeight
()
==
height
)
resMatchReps
.
push_back
(
*
repIt
);
}
}
if
(
resMatchReps
.
empty
())
return
select
(
period
,
bitrate
);
else
return
select
(
resMatchReps
,
0
,
bitrate
);
}
Representation
*
RepresentationSelector
::
select
(
std
::
vector
<
Representation
*>&
reps
,
uint64_t
minbitrate
,
uint64_t
maxbitrate
)
const
{
Representation
*
candidate
=
NULL
;
std
::
vector
<
Representation
*>::
const_iterator
repIt
;
for
(
repIt
=
reps
.
begin
();
repIt
!=
reps
.
end
();
repIt
++
)
{
if
(
(
*
repIt
)
->
getBandwidth
()
<
maxbitrate
&&
(
*
repIt
)
->
getBandwidth
()
>
minbitrate
)
{
candidate
=
(
*
repIt
);
minbitrate
=
(
*
repIt
)
->
getBandwidth
();
}
}
return
candidate
;
}
modules/stream_filter/dash/adaptationlogic/Representationselectors.hpp
0 → 100644
View file @
890887de
/*
* Representationselectors.hpp
*****************************************************************************
* Copyright (C) 2014 - VideoLAN authors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef REPRESENTATIONSELECTORS_HPP
#define REPRESENTATIONSELECTORS_HPP
#include "mpd/Representation.h"
#include "mpd/Period.h"
using
namespace
dash
::
mpd
;
namespace
dash
{
namespace
logic
{
class
RepresentationSelector
{
public:
RepresentationSelector
();
virtual
~
RepresentationSelector
()
{}
virtual
Representation
*
select
(
Period
*
period
)
const
;
virtual
Representation
*
select
(
Period
*
period
,
uint64_t
bitrate
)
const
;
virtual
Representation
*
select
(
Period
*
period
,
uint64_t
bitrate
,
int
width
,
int
height
)
const
;
protected:
virtual
Representation
*
select
(
std
::
vector
<
Representation
*>&
reps
,
uint64_t
minbitrate
,
uint64_t
maxbitrate
)
const
;
};
}
}
#endif // REPRESENTATIONSELECTORS_HPP
modules/stream_filter/dash/mpd/BasicCMManager.cpp
View file @
890887de
...
...
@@ -34,8 +34,3 @@ BasicCMManager::BasicCMManager(MPD *mpd) :
{
}
Representation
*
BasicCMManager
::
getRepresentation
(
Period
*
period
,
uint64_t
bitrate
,
int
,
int
)
const
{
return
IMPDManager
::
getRepresentation
(
period
,
bitrate
);
}
modules/stream_filter/dash/mpd/BasicCMManager.h
View file @
890887de
...
...
@@ -42,8 +42,6 @@ namespace dash
public:
BasicCMManager
(
MPD
*
mpd
);
Representation
*
getRepresentation
(
Period
*
period
,
uint64_t
bitrate
,
int
width
,
int
height
)
const
;
};
}
}
...
...
modules/stream_filter/dash/mpd/IMPDManager.cpp
View file @
890887de
...
...
@@ -69,35 +69,3 @@ const MPD* IMPDManager::getMPD() const
{
return
mpd
;
}
Representation
*
IMPDManager
::
getBestRepresentation
(
Period
*
period
)
const
{
return
getRepresentation
(
period
,
std
::
numeric_limits
<
uint64_t
>::
max
());
}
Representation
*
IMPDManager
::
getRepresentation
(
Period
*
period
,
uint64_t
bitrate
)
const
{
if
(
period
==
NULL
)
return
NULL
;
std
::
vector
<
AdaptationSet
*>
adaptSet
=
period
->
getAdaptationSets
();
Representation
*
best
=
NULL
;
for
(
size_t
i
=
0
;
i
<
adaptSet
.
size
();
i
++
)
{
std
::
vector
<
Representation
*>
reps
=
adaptSet
.
at
(
i
)
->
getRepresentations
();
for
(
size_t
j
=
0
;
j
<
reps
.
size
();
j
++
)
{
uint64_t
currentBitrate
=
reps
.
at
(
j
)
->
getBandwidth
();
if
(
best
==
NULL
||
(
currentBitrate
>
best
->
getBandwidth
()
&&
currentBitrate
<
bitrate
)
)
{
best
=
reps
.
at
(
j
);
}
}
}
return
best
;
}
modules/stream_filter/dash/mpd/IMPDManager.h
View file @
890887de
...
...
@@ -42,11 +42,8 @@ namespace dash
virtual
const
std
::
vector
<
Period
*>&
getPeriods
()
const
;
virtual
Period
*
getFirstPeriod
()
const
;
virtual
Period
*
getNextPeriod
(
Period
*
period
);
virtual
Representation
*
getBestRepresentation
(
Period
*
period
)
const
;
virtual
Representation
*
getRepresentation
(
Period
*
period
,
uint64_t
bitrate
)
const
;
virtual
const
MPD
*
getMPD
()
const
;
virtual
Representation
*
getRepresentation
(
Period
*
period
,
uint64_t
bitrate
,
int
width
,
int
height
)
const
=
0
;
protected:
MPD
*
mpd
;
};
...
...
modules/stream_filter/dash/mpd/IsoffMainManager.cpp
View file @
890887de
...
...
@@ -27,8 +27,10 @@
#endif
#include "IsoffMainManager.h"
#include "../adaptationlogic/Representationselectors.hpp"
using
namespace
dash
::
mpd
;
using
namespace
dash
::
logic
;
IsoffMainManager
::
IsoffMainManager
(
MPD
*
mpd
)
:
IMPDManager
(
mpd
)
...
...
@@ -36,37 +38,3 @@ IsoffMainManager::IsoffMainManager(MPD *mpd) :
}
Representation
*
IsoffMainManager
::
getRepresentation
(
Period
*
period
,
uint64_t
bitrate
,
int
width
,
int
height
)
const
{
if
(
period
==
NULL
)
return
NULL
;
std
::
vector
<
AdaptationSet
*>
adaptationSets
=
period
->
getAdaptationSets
();
std
::
vector
<
Representation
*>
resMatchReps
;
for
(
size_t
i
=
0
;
i
<
adaptationSets
.
size
();
i
++
)
{
std
::
vector
<
Representation
*>
reps
=
adaptationSets
.
at
(
i
)
->
getRepresentations
();
for
(
size_t
j
=
0
;
j
<
reps
.
size
();
j
++
)
{
if
(
reps
.
at
(
j
)
->
getWidth
()
==
width
&&
reps
.
at
(
j
)
->
getHeight
()
==
height
)
resMatchReps
.
push_back
(
reps
.
at
(
j
));
}
}
if
(
resMatchReps
.
size
()
==
0
)
return
IMPDManager
::
getRepresentation
(
period
,
bitrate
);
Representation
*
best
=
NULL
;
for
(
size_t
j
=
0
;
j
<
resMatchReps
.
size
();
j
++
)
{
uint64_t
currentBitrate
=
resMatchReps
.
at
(
j
)
->
getBandwidth
();
if
(
best
==
NULL
||
(
currentBitrate
>
best
->
getBandwidth
()
&&
currentBitrate
<
bitrate
))
{
best
=
resMatchReps
.
at
(
j
);
}
}
return
best
;
}
modules/stream_filter/dash/mpd/IsoffMainManager.h
View file @
890887de
...
...
@@ -43,8 +43,6 @@ namespace dash
public:
IsoffMainManager
(
MPD
*
mpd
);
Representation
*
getRepresentation
(
Period
*
period
,
uint64_t
bitrate
,
int
width
,
int
height
)
const
;
};
}
}
...
...
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