Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
1a4b8ae2
Commit
1a4b8ae2
authored
Nov 25, 2015
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add minAheadTime for live playlists
parent
4b7af730
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
0 deletions
+74
-0
modules/demux/adaptative/SegmentTracker.cpp
modules/demux/adaptative/SegmentTracker.cpp
+10
-0
modules/demux/adaptative/SegmentTracker.hpp
modules/demux/adaptative/SegmentTracker.hpp
+1
-0
modules/demux/adaptative/Streams.cpp
modules/demux/adaptative/Streams.cpp
+7
-0
modules/demux/adaptative/Streams.hpp
modules/demux/adaptative/Streams.hpp
+1
-0
modules/demux/adaptative/playlist/BaseRepresentation.cpp
modules/demux/adaptative/playlist/BaseRepresentation.cpp
+28
-0
modules/demux/adaptative/playlist/BaseRepresentation.h
modules/demux/adaptative/playlist/BaseRepresentation.h
+2
-0
modules/demux/adaptative/playlist/SegmentTimeline.cpp
modules/demux/adaptative/playlist/SegmentTimeline.cpp
+24
-0
modules/demux/adaptative/playlist/SegmentTimeline.h
modules/demux/adaptative/playlist/SegmentTimeline.h
+1
-0
No files found.
modules/demux/adaptative/SegmentTracker.cpp
View file @
1a4b8ae2
...
...
@@ -225,6 +225,16 @@ mtime_t SegmentTracker::getSegmentStart() const
return
0
;
}
mtime_t
SegmentTracker
::
getMinAheadTime
()
const
{
BaseRepresentation
*
rep
=
curRepresentation
;
if
(
!
rep
)
rep
=
logic
->
getNextRepresentation
(
adaptationSet
,
NULL
);
if
(
rep
)
return
rep
->
getMinAheadTime
(
count
);
return
0
;
}
void
SegmentTracker
::
registerListener
(
SegmentTrackerListenerInterface
*
listener
)
{
listeners
.
push_back
(
listener
);
...
...
modules/demux/adaptative/SegmentTracker.hpp
View file @
1a4b8ae2
...
...
@@ -100,6 +100,7 @@ namespace adaptative
bool
setPositionByTime
(
mtime_t
,
bool
,
bool
);
void
setPositionByNumber
(
uint64_t
,
bool
);
mtime_t
getSegmentStart
()
const
;
mtime_t
getMinAheadTime
()
const
;
void
registerListener
(
SegmentTrackerListenerInterface
*
);
void
pruneFromCurrent
();
void
updateSelected
();
...
...
modules/demux/adaptative/Streams.cpp
View file @
1a4b8ae2
...
...
@@ -120,6 +120,13 @@ mtime_t AbstractStream::getPCR() const
return
pcr
;
}
mtime_t
AbstractStream
::
getMinAheadTime
()
const
{
if
(
!
segmentTracker
)
return
0
;
return
segmentTracker
->
getMinAheadTime
();
}
mtime_t
AbstractStream
::
getBufferingLevel
()
const
{
return
fakeesout
->
commandsqueue
.
getBufferingLevel
();
...
...
modules/demux/adaptative/Streams.hpp
View file @
1a4b8ae2
...
...
@@ -66,6 +66,7 @@ namespace adaptative
bool
isEOF
()
const
;
mtime_t
getPCR
()
const
;
mtime_t
getBufferingLevel
()
const
;
mtime_t
getMinAheadTime
()
const
;
mtime_t
getFirstDTS
()
const
;
int
esCount
()
const
;
bool
seekAble
()
const
;
...
...
modules/demux/adaptative/playlist/BaseRepresentation.cpp
View file @
1a4b8ae2
...
...
@@ -82,6 +82,34 @@ bool BaseRepresentation::consistentSegmentNumber() const
return
b_consistent
;
}
mtime_t
BaseRepresentation
::
getMinAheadTime
(
uint64_t
curnum
)
const
{
std
::
vector
<
ISegment
*>
seglist
;
getSegments
(
INFOTYPE_MEDIA
,
seglist
);
if
(
seglist
.
size
()
==
1
&&
seglist
.
front
()
->
isTemplate
())
{
const
MediaSegmentTemplate
*
templ
=
dynamic_cast
<
MediaSegmentTemplate
*>
(
seglist
.
front
());
const
SegmentTimeline
*
timeline
;
if
(
templ
&&
(
timeline
=
templ
->
segmentTimeline
.
Get
()))
{
const
uint64_t
timescale
=
templ
->
inheritTimescale
();
return
timeline
->
getMinAheadScaledTime
(
curnum
)
*
CLOCK_FREQ
/
timescale
;
}
}
mtime_t
minTime
=
0
;
std
::
vector
<
ISegment
*>::
const_iterator
it
;
for
(
it
=
seglist
.
begin
();
it
!=
seglist
.
end
();
++
it
)
{
const
ISegment
*
seg
=
*
it
;
if
(
seg
->
getSequenceNumber
()
>
curnum
)
minTime
+=
seg
->
duration
.
Get
()
*
CLOCK_FREQ
/
inheritTimescale
();
}
return
minTime
;
}
void
BaseRepresentation
::
debug
(
vlc_object_t
*
obj
,
int
indent
)
const
{
std
::
string
text
(
indent
,
' '
);
...
...
modules/demux/adaptative/playlist/BaseRepresentation.h
View file @
1a4b8ae2
...
...
@@ -61,6 +61,8 @@ namespace adaptative
virtual
bool
needsUpdate
()
const
;
bool
consistentSegmentNumber
()
const
;
virtual
mtime_t
getMinAheadTime
(
uint64_t
)
const
;
virtual
void
debug
(
vlc_object_t
*
,
int
=
0
)
const
;
/* for segment templates */
...
...
modules/demux/adaptative/playlist/SegmentTimeline.cpp
View file @
1a4b8ae2
...
...
@@ -59,6 +59,30 @@ void SegmentTimeline::addElement(uint64_t number, stime_t d, uint64_t r, stime_t
}
}
mtime_t
SegmentTimeline
::
getMinAheadScaledTime
(
uint64_t
number
)
const
{
stime_t
totalscaledtime
=
0
;
std
::
list
<
Element
*>::
const_reverse_iterator
it
;
for
(
it
=
elements
.
rbegin
();
it
!=
elements
.
rend
();
++
it
)
{
const
Element
*
el
=
*
it
;
if
(
number
<
el
->
number
)
{
totalscaledtime
+=
(
el
->
d
*
(
el
->
r
+
1
));
break
;
}
else
if
(
number
<=
el
->
number
+
el
->
r
)
{
totalscaledtime
+=
el
->
d
*
(
el
->
number
+
el
->
r
-
number
);
}
else
break
;
}
return
totalscaledtime
;
}
uint64_t
SegmentTimeline
::
getElementNumberByScaledPlaybackTime
(
stime_t
scaled
)
const
{
uint64_t
prevnumber
=
0
;
...
...
modules/demux/adaptative/playlist/SegmentTimeline.h
View file @
1a4b8ae2
...
...
@@ -47,6 +47,7 @@ namespace adaptative
void
addElement
(
uint64_t
,
stime_t
d
,
uint64_t
r
=
0
,
stime_t
t
=
0
);
uint64_t
getElementNumberByScaledPlaybackTime
(
stime_t
)
const
;
stime_t
getScaledPlaybackTimeByElementNumber
(
uint64_t
)
const
;
stime_t
getMinAheadScaledTime
(
uint64_t
)
const
;
uint64_t
maxElementNumber
()
const
;
uint64_t
minElementNumber
()
const
;
size_t
pruneBySequenceNumber
(
uint64_t
);
...
...
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