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
2bf7935f
Commit
2bf7935f
authored
Jun 07, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add pruning by position
parent
425d321a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
75 additions
and
6 deletions
+75
-6
modules/demux/adaptative/SegmentTracker.cpp
modules/demux/adaptative/SegmentTracker.cpp
+6
-0
modules/demux/adaptative/SegmentTracker.hpp
modules/demux/adaptative/SegmentTracker.hpp
+1
-0
modules/demux/adaptative/Streams.cpp
modules/demux/adaptative/Streams.cpp
+5
-0
modules/demux/adaptative/Streams.hpp
modules/demux/adaptative/Streams.hpp
+1
-0
modules/demux/adaptative/playlist/AbstractPlaylist.cpp
modules/demux/adaptative/playlist/AbstractPlaylist.cpp
+6
-0
modules/demux/adaptative/playlist/AbstractPlaylist.hpp
modules/demux/adaptative/playlist/AbstractPlaylist.hpp
+1
-0
modules/demux/adaptative/playlist/SegmentInformation.cpp
modules/demux/adaptative/playlist/SegmentInformation.cpp
+24
-5
modules/demux/adaptative/playlist/SegmentInformation.hpp
modules/demux/adaptative/playlist/SegmentInformation.hpp
+2
-1
modules/demux/adaptative/playlist/SegmentList.cpp
modules/demux/adaptative/playlist/SegmentList.cpp
+26
-0
modules/demux/adaptative/playlist/SegmentList.h
modules/demux/adaptative/playlist/SegmentList.h
+3
-0
No files found.
modules/demux/adaptative/SegmentTracker.cpp
View file @
2bf7935f
...
@@ -131,3 +131,9 @@ mtime_t SegmentTracker::getSegmentStart() const
...
@@ -131,3 +131,9 @@ mtime_t SegmentTracker::getSegmentStart() const
else
else
return
0
;
return
0
;
}
}
void
SegmentTracker
::
pruneFromCurrent
()
{
if
(
playlist
->
isLive
())
playlist
->
pruneBySegmentNumber
(
count
);
}
modules/demux/adaptative/SegmentTracker.hpp
View file @
2bf7935f
...
@@ -61,6 +61,7 @@ namespace adaptative
...
@@ -61,6 +61,7 @@ namespace adaptative
Chunk
*
getNextChunk
(
StreamType
);
Chunk
*
getNextChunk
(
StreamType
);
bool
setPosition
(
mtime_t
,
bool
,
bool
);
bool
setPosition
(
mtime_t
,
bool
,
bool
);
mtime_t
getSegmentStart
()
const
;
mtime_t
getSegmentStart
()
const
;
void
pruneFromCurrent
();
private:
private:
bool
initializing
;
bool
initializing
;
...
...
modules/demux/adaptative/Streams.cpp
View file @
2bf7935f
...
@@ -249,6 +249,11 @@ mtime_t Stream::getPosition() const
...
@@ -249,6 +249,11 @@ mtime_t Stream::getPosition() const
return
segmentTracker
->
getSegmentStart
();
return
segmentTracker
->
getSegmentStart
();
}
}
void
Stream
::
prune
()
{
segmentTracker
->
pruneFromCurrent
();
}
AbstractStreamOutput
::
AbstractStreamOutput
(
demux_t
*
demux
)
AbstractStreamOutput
::
AbstractStreamOutput
(
demux_t
*
demux
)
{
{
realdemux
=
demux
;
realdemux
=
demux
;
...
...
modules/demux/adaptative/Streams.hpp
View file @
2bf7935f
...
@@ -71,6 +71,7 @@ namespace adaptative
...
@@ -71,6 +71,7 @@ namespace adaptative
status
demux
(
HTTPConnectionManager
*
,
mtime_t
);
status
demux
(
HTTPConnectionManager
*
,
mtime_t
);
bool
setPosition
(
mtime_t
,
bool
);
bool
setPosition
(
mtime_t
,
bool
);
mtime_t
getPosition
()
const
;
mtime_t
getPosition
()
const
;
void
prune
();
private:
private:
Chunk
*
getChunk
();
Chunk
*
getChunk
();
...
...
modules/demux/adaptative/playlist/AbstractPlaylist.cpp
View file @
2bf7935f
...
@@ -145,3 +145,9 @@ void AbstractPlaylist::mergeWith(AbstractPlaylist *updatedAbstractPlaylist, mtim
...
@@ -145,3 +145,9 @@ void AbstractPlaylist::mergeWith(AbstractPlaylist *updatedAbstractPlaylist, mtim
periods
.
at
(
i
)
->
mergeWith
(
updatedAbstractPlaylist
->
periods
.
at
(
i
),
prunebarrier
);
periods
.
at
(
i
)
->
mergeWith
(
updatedAbstractPlaylist
->
periods
.
at
(
i
),
prunebarrier
);
}
}
void
AbstractPlaylist
::
pruneBySegmentNumber
(
uint64_t
num
)
{
for
(
size_t
i
=
0
;
i
<
periods
.
size
();
i
++
)
periods
.
at
(
i
)
->
pruneBySegmentNumber
(
num
);
}
modules/demux/adaptative/playlist/AbstractPlaylist.hpp
View file @
2bf7935f
...
@@ -54,6 +54,7 @@ namespace adaptative
...
@@ -54,6 +54,7 @@ namespace adaptative
virtual
BasePeriod
*
getNextPeriod
(
BasePeriod
*
period
);
virtual
BasePeriod
*
getNextPeriod
(
BasePeriod
*
period
);
void
mergeWith
(
AbstractPlaylist
*
,
mtime_t
=
0
);
void
mergeWith
(
AbstractPlaylist
*
,
mtime_t
=
0
);
void
pruneBySegmentNumber
(
uint64_t
);
void
getTimeLinesBoundaries
(
mtime_t
*
,
mtime_t
*
)
const
;
void
getTimeLinesBoundaries
(
mtime_t
*
,
mtime_t
*
)
const
;
void
getPlaylistDurationsRange
(
mtime_t
*
,
mtime_t
*
)
const
;
void
getPlaylistDurationsRange
(
mtime_t
*
,
mtime_t
*
)
const
;
...
...
modules/demux/adaptative/playlist/SegmentInformation.cpp
View file @
2bf7935f
...
@@ -69,8 +69,10 @@ AbstractPlaylist * SegmentInformation::getPlaylist() const
...
@@ -69,8 +69,10 @@ AbstractPlaylist * SegmentInformation::getPlaylist() const
return
NULL
;
return
NULL
;
}
}
std
::
size_t
SegmentInformation
::
getSegments
(
SegmentInfoType
type
,
vector
<
ISegment
*>
&
retSegments
)
const
std
::
size_t
SegmentInformation
::
getSegments
(
SegmentInfoType
type
,
vector
<
ISegment
*>
&
retSegments
,
std
::
size_t
*
offset
)
const
{
{
std
::
size_t
off
=
0
;
switch
(
type
)
switch
(
type
)
{
{
case
INFOTYPE_INIT
:
case
INFOTYPE_INIT
:
...
@@ -106,6 +108,7 @@ std::size_t SegmentInformation::getSegments(SegmentInfoType type, vector<ISegmen
...
@@ -106,6 +108,7 @@ std::size_t SegmentInformation::getSegments(SegmentInfoType type, vector<ISegmen
std
::
vector
<
ISegment
*>
list
=
(
*
it
)
->
subSegments
();
std
::
vector
<
ISegment
*>
list
=
(
*
it
)
->
subSegments
();
retSegments
.
insert
(
retSegments
.
end
(),
list
.
begin
(),
list
.
end
()
);
retSegments
.
insert
(
retSegments
.
end
(),
list
.
begin
(),
list
.
end
()
);
}
}
off
=
segmentList
->
getOffset
();
}
}
else
if
(
segmentBase
)
else
if
(
segmentBase
)
{
{
...
@@ -134,9 +137,15 @@ std::size_t SegmentInformation::getSegments(SegmentInfoType type, vector<ISegmen
...
@@ -134,9 +137,15 @@ std::size_t SegmentInformation::getSegments(SegmentInfoType type, vector<ISegmen
}
}
if
(
retSegments
.
empty
()
&&
parent
)
if
(
retSegments
.
empty
()
&&
parent
)
return
parent
->
getSegments
(
type
,
retSegments
);
{
return
parent
->
getSegments
(
type
,
retSegments
,
offset
);
}
else
else
{
if
(
offset
)
*
offset
=
off
;
return
retSegments
.
size
();
return
retSegments
.
size
();
}
}
}
std
::
size_t
SegmentInformation
::
getAllSegments
(
vector
<
ISegment
*>
&
retSegments
)
const
std
::
size_t
SegmentInformation
::
getAllSegments
(
vector
<
ISegment
*>
&
retSegments
)
const
...
@@ -155,7 +164,8 @@ ISegment * SegmentInformation::getSegment(SegmentInfoType type, uint64_t pos) co
...
@@ -155,7 +164,8 @@ ISegment * SegmentInformation::getSegment(SegmentInfoType type, uint64_t pos) co
ISegment
*
segment
=
NULL
;
ISegment
*
segment
=
NULL
;
vector
<
ISegment
*>
retSegments
;
vector
<
ISegment
*>
retSegments
;
const
size_t
size
=
getSegments
(
type
,
retSegments
);
std
::
size_t
offset
=
0
;
const
size_t
size
=
getSegments
(
type
,
retSegments
,
&
offset
);
if
(
size
)
if
(
size
)
{
{
/* check if that's a template (fixme: find a better way) */
/* check if that's a template (fixme: find a better way) */
...
@@ -166,9 +176,9 @@ ISegment * SegmentInformation::getSegment(SegmentInfoType type, uint64_t pos) co
...
@@ -166,9 +176,9 @@ ISegment * SegmentInformation::getSegment(SegmentInfoType type, uint64_t pos) co
templ
->
segmentTimeline
.
Get
()
->
maxElementNumber
()
>
pos
)
templ
->
segmentTimeline
.
Get
()
->
maxElementNumber
()
>
pos
)
return
templ
;
return
templ
;
}
}
else
if
(
pos
<
size
)
else
if
(
pos
<
size
+
offset
&&
pos
>=
offset
)
{
{
segment
=
retSegments
[
pos
];
segment
=
retSegments
[
pos
-
offset
];
}
}
}
}
...
@@ -291,6 +301,15 @@ void SegmentInformation::mergeWith(SegmentInformation *updated, mtime_t prunetim
...
@@ -291,6 +301,15 @@ void SegmentInformation::mergeWith(SegmentInformation *updated, mtime_t prunetim
}
}
}
}
void
SegmentInformation
::
pruneBySegmentNumber
(
uint64_t
num
)
{
if
(
segmentList
)
segmentList
->
pruneBySegmentNumber
(
num
);
for
(
size_t
i
=
0
;
i
<
childs
.
size
();
i
++
)
childs
.
at
(
i
)
->
pruneBySegmentNumber
(
num
);
}
bool
SegmentInformation
::
canBitswitch
()
const
bool
SegmentInformation
::
canBitswitch
()
const
{
{
if
(
bitswitch_policy
==
BITSWITCH_INHERIT
)
if
(
bitswitch_policy
==
BITSWITCH_INHERIT
)
...
...
modules/demux/adaptative/playlist/SegmentInformation.hpp
View file @
2bf7935f
...
@@ -80,10 +80,11 @@ namespace adaptative
...
@@ -80,10 +80,11 @@ namespace adaptative
void
collectTimelines
(
std
::
vector
<
SegmentTimeline
*>
*
)
const
;
void
collectTimelines
(
std
::
vector
<
SegmentTimeline
*>
*
)
const
;
void
getDurationsRange
(
mtime_t
*
,
mtime_t
*
)
const
;
void
getDurationsRange
(
mtime_t
*
,
mtime_t
*
)
const
;
virtual
void
mergeWith
(
SegmentInformation
*
,
mtime_t
);
virtual
void
mergeWith
(
SegmentInformation
*
,
mtime_t
);
virtual
void
pruneBySegmentNumber
(
uint64_t
);
protected:
protected:
std
::
size_t
getAllSegments
(
std
::
vector
<
ISegment
*>
&
)
const
;
std
::
size_t
getAllSegments
(
std
::
vector
<
ISegment
*>
&
)
const
;
std
::
size_t
getSegments
(
SegmentInfoType
,
std
::
vector
<
ISegment
*>&
)
const
;
std
::
size_t
getSegments
(
SegmentInfoType
,
std
::
vector
<
ISegment
*>&
,
std
::
size_t
*
=
NULL
)
const
;
std
::
vector
<
SegmentInformation
*>
childs
;
std
::
vector
<
SegmentInformation
*>
childs
;
SegmentInformation
*
parent
;
SegmentInformation
*
parent
;
...
...
modules/demux/adaptative/playlist/SegmentList.cpp
View file @
2bf7935f
...
@@ -31,6 +31,7 @@ using namespace adaptative::playlist;
...
@@ -31,6 +31,7 @@ using namespace adaptative::playlist;
SegmentList
::
SegmentList
(
SegmentInformation
*
parent
)
:
SegmentList
::
SegmentList
(
SegmentInformation
*
parent
)
:
SegmentInfoCommon
(
parent
),
TimescaleAble
(
parent
)
SegmentInfoCommon
(
parent
),
TimescaleAble
(
parent
)
{
{
pruned
=
0
;
}
}
SegmentList
::~
SegmentList
()
SegmentList
::~
SegmentList
()
{
{
...
@@ -64,3 +65,28 @@ void SegmentList::mergeWith(SegmentList *updated)
...
@@ -64,3 +65,28 @@ void SegmentList::mergeWith(SegmentList *updated)
}
}
updated
->
segments
.
clear
();
updated
->
segments
.
clear
();
}
}
void
SegmentList
::
pruneBySegmentNumber
(
uint64_t
tobelownum
)
{
if
(
tobelownum
<
pruned
)
return
;
uint64_t
current
=
pruned
;
std
::
vector
<
Segment
*>::
iterator
it
=
segments
.
begin
();
while
(
it
!=
segments
.
end
()
&&
current
<
tobelownum
)
{
Segment
*
seg
=
*
it
;
if
(
seg
->
chunksuse
.
Get
())
/* can't prune from here, still in use */
break
;
delete
*
it
;
it
=
segments
.
erase
(
it
);
current
++
;
pruned
++
;
}
}
std
::
size_t
SegmentList
::
getOffset
()
const
{
return
pruned
;
}
modules/demux/adaptative/playlist/SegmentList.h
View file @
2bf7935f
...
@@ -48,9 +48,12 @@ namespace adaptative
...
@@ -48,9 +48,12 @@ namespace adaptative
const
std
::
vector
<
Segment
*>&
getSegments
()
const
;
const
std
::
vector
<
Segment
*>&
getSegments
()
const
;
void
addSegment
(
Segment
*
seg
);
void
addSegment
(
Segment
*
seg
);
void
mergeWith
(
SegmentList
*
);
void
mergeWith
(
SegmentList
*
);
void
pruneBySegmentNumber
(
uint64_t
);
std
::
size_t
getOffset
()
const
;
private:
private:
std
::
vector
<
Segment
*>
segments
;
std
::
vector
<
Segment
*>
segments
;
std
::
size_t
pruned
;
};
};
}
}
}
}
...
...
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