Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
bfe02ea6
Commit
bfe02ea6
authored
Jun 07, 2015
by
François Cartegnie
🤞
Browse files
demux: adaptative: fix quality switch policies
parent
0771fb4b
Changes
6
Hide whitespace changes
Inline
Side-by-side
modules/demux/adaptative/SegmentTracker.cpp
View file @
bfe02ea6
...
...
@@ -62,7 +62,7 @@ Chunk * SegmentTracker::getNextChunk(StreamType type)
if
(
!
currentPeriod
)
return
NULL
;
if
(
prevRepresentation
&&
!
prevRepresentation
->
canBitswitch
()
)
if
(
prevRepresentation
&&
prevRepresentation
->
getSwitchPolicy
()
==
SegmentInformation
::
SWITCH_UNAVAILABLE
)
rep
=
prevRepresentation
;
else
rep
=
logic
->
getCurrentRepresentation
(
type
,
currentPeriod
);
...
...
modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
View file @
bfe02ea6
...
...
@@ -69,7 +69,7 @@ void BaseAdaptationSet::addRepresentation(BaseRepresentation *rep)
childs
.
push_back
(
rep
);
}
void
BaseAdaptationSet
::
set
BitstreamSwitching
(
bool
value
)
void
BaseAdaptationSet
::
set
SwitchPolicy
(
bool
value
)
{
this
->
isBitstreamSwitching
=
value
;
}
...
...
modules/demux/adaptative/playlist/BaseAdaptationSet.h
View file @
bfe02ea6
...
...
@@ -47,7 +47,7 @@ namespace adaptative
virtual
const
std
::
string
&
getMimeType
()
const
;
/*reimpl*/
std
::
vector
<
BaseRepresentation
*>&
getRepresentations
();
void
set
BitstreamSwitching
(
bool
value
);
void
set
SwitchPolicy
(
bool
value
);
bool
getBitstreamSwitching
()
const
;
void
addRepresentation
(
BaseRepresentation
*
rep
);
void
debug
(
vlc_object_t
*
,
int
=
0
)
const
;
...
...
modules/demux/adaptative/playlist/SegmentInformation.cpp
View file @
bfe02ea6
...
...
@@ -51,7 +51,7 @@ void SegmentInformation::init()
segmentBase
=
NULL
;
segmentList
=
NULL
;
mediaSegmentTemplate
=
NULL
;
bit
switch
_
policy
=
BIT
SWITCH_
INHERIT
;
switchpolicy
=
SWITCH_
UNKNOWN
;
}
SegmentInformation
::~
SegmentInformation
()
...
...
@@ -306,12 +306,12 @@ void SegmentInformation::pruneBySegmentNumber(uint64_t num)
childs
.
at
(
i
)
->
pruneBySegmentNumber
(
num
);
}
bool
SegmentInformation
::
canBitswitch
()
const
SegmentInformation
::
SwitchPolicy
SegmentInformation
::
getSwitchPolicy
()
const
{
if
(
bit
switch
_
policy
==
BIT
SWITCH_
INHERIT
)
return
(
parent
)
?
parent
->
canBitswitch
()
:
false
;
if
(
switchpolicy
==
SWITCH_
UNKNOWN
)
return
(
parent
)
?
parent
->
getSwitchPolicy
()
:
SWITCH_UNAVAILABLE
;
else
return
(
bit
switch
_
policy
==
BITSWITCH_YES
)
;
return
switchpolicy
;
}
mtime_t
SegmentInformation
::
getPeriodStart
()
const
...
...
@@ -385,9 +385,9 @@ void SegmentInformation::SplitUsingIndex(std::vector<SplitPoint> &splitlist)
}
}
void
SegmentInformation
::
set
BitstreamSwitching
(
bool
bitswitch
)
void
SegmentInformation
::
set
SwitchPolicy
(
SegmentInformation
::
SwitchPolicy
policy
)
{
bit
switch
_
policy
=
(
bitswitch
)
?
BITSWITCH_YES
:
BITSWITCH_NO
;
switchpolicy
=
policy
;
}
Url
SegmentInformation
::
getUrlSegment
()
const
...
...
modules/demux/adaptative/playlist/SegmentInformation.hpp
View file @
bfe02ea6
...
...
@@ -54,7 +54,14 @@ namespace adaptative
SegmentInformation
(
SegmentInformation
*
=
0
);
explicit
SegmentInformation
(
AbstractPlaylist
*
);
virtual
~
SegmentInformation
();
bool
canBitswitch
()
const
;
typedef
enum
SwitchPolicy
{
SWITCH_UNKNOWN
,
SWITCH_UNAVAILABLE
,
SWITCH_SEGMENT_ALIGNED
,
SWITCH_BITSWITCHEABLE
}
SwitchPolicy
;
SwitchPolicy
getSwitchPolicy
()
const
;
virtual
mtime_t
getPeriodStart
()
const
;
virtual
AbstractPlaylist
*
getPlaylist
()
const
;
...
...
@@ -87,12 +94,13 @@ namespace adaptative
std
::
size_t
getSegments
(
SegmentInfoType
,
std
::
vector
<
ISegment
*>&
,
std
::
size_t
*
=
NULL
)
const
;
std
::
vector
<
SegmentInformation
*>
childs
;
SegmentInformation
*
parent
;
SwitchPolicy
switchpolicy
;
public:
void
setSegmentList
(
SegmentList
*
);
void
setSegmentBase
(
SegmentBase
*
);
void
setSegmentTemplate
(
MediaSegmentTemplate
*
);
void
set
BitstreamSwitching
(
bool
);
void
set
SwitchPolicy
(
SwitchPolicy
);
virtual
Url
getUrlSegment
()
const
;
/* impl */
Property
<
Url
*>
baseUrl
;
...
...
@@ -105,13 +113,6 @@ namespace adaptative
SegmentBase
*
segmentBase
;
SegmentList
*
segmentList
;
MediaSegmentTemplate
*
mediaSegmentTemplate
;
enum
BitswitchPolicy
{
BITSWITCH_INHERIT
,
BITSWITCH_YES
,
BITSWITCH_NO
}
bitswitch_policy
;
};
}
}
...
...
modules/demux/dash/mpd/IsoffMainParser.cpp
View file @
bfe02ea6
...
...
@@ -196,8 +196,17 @@ size_t IsoffMainParser::parseSegmentInformation(Node *node, SegmentInformation *
total
+=
parseSegmentBase
(
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentBase"
),
info
);
total
+=
parseSegmentList
(
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentList"
),
info
);
total
+=
parseSegmentTemplate
(
DOMHelper
::
getFirstChildElementByName
(
node
,
"SegmentTemplate"
),
info
);
if
(
node
->
hasAttribute
(
"bitstreamSwitching"
))
info
->
setBitstreamSwitching
(
node
->
getAttributeValue
(
"bitstreamSwitching"
)
==
"true"
);
if
(
node
->
hasAttribute
(
"bitstreamSwitching"
)
&&
node
->
getAttributeValue
(
"bitstreamSwitching"
)
==
"true"
)
{
info
->
setSwitchPolicy
(
SegmentInformation
::
SWITCH_BITSWITCHEABLE
);
}
else
if
(
node
->
hasAttribute
(
"segmentAlignment"
))
{
if
(
node
->
getAttributeValue
(
"segmentAlignment"
)
==
"true"
)
info
->
setSwitchPolicy
(
SegmentInformation
::
SWITCH_SEGMENT_ALIGNED
);
else
info
->
setSwitchPolicy
(
SegmentInformation
::
SWITCH_UNAVAILABLE
);
}
if
(
node
->
hasAttribute
(
"timescale"
))
info
->
timescale
.
Set
(
Integer
<
uint64_t
>
(
node
->
getAttributeValue
(
"timescale"
)));
return
total
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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