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
72267b16
Commit
72267b16
authored
Dec 29, 2015
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: split segment tracking between cur and next
parent
4bf1e07a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
19 deletions
+23
-19
modules/demux/adaptative/SegmentTracker.cpp
modules/demux/adaptative/SegmentTracker.cpp
+21
-18
modules/demux/adaptative/SegmentTracker.hpp
modules/demux/adaptative/SegmentTracker.hpp
+2
-1
No files found.
modules/demux/adaptative/SegmentTracker.cpp
View file @
72267b16
...
...
@@ -51,7 +51,7 @@ SegmentTrackerEvent::SegmentTrackerEvent(const StreamFormat *fmt)
SegmentTracker
::
SegmentTracker
(
AbstractAdaptationLogic
*
logic_
,
BaseAdaptationSet
*
adaptSet
)
{
first
=
true
;
coun
t
=
0
;
nex
t
=
0
;
initializing
=
true
;
index_sent
=
false
;
init_sent
=
false
;
...
...
@@ -78,7 +78,7 @@ bool SegmentTracker::segmentsListReady() const
if
(
!
rep
)
rep
=
logic
->
getNextRepresentation
(
adaptationSet
,
NULL
);
if
(
rep
&&
rep
->
getPlaylist
()
->
isLive
())
return
rep
->
getMinAheadTime
(
(
count
)
?
count
-
1
:
count
)
>
0
;
return
rep
->
getMinAheadTime
(
curNumber
)
>
0
;
return
true
;
}
...
...
@@ -132,24 +132,24 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionM
bool
b_updated
=
false
;
/* Ensure ephemere content is updated/loaded */
if
(
rep
->
needsUpdate
())
b_updated
=
rep
->
runLocalUpdates
(
getPlaybackTime
(),
c
ount
,
false
);
b_updated
=
rep
->
runLocalUpdates
(
getPlaybackTime
(),
c
urNumber
,
false
);
if
(
prevRep
&&
!
rep
->
consistentSegmentNumber
())
{
/* Convert our segment number */
coun
t
=
rep
->
translateSegmentNumber
(
coun
t
,
prevRep
);
nex
t
=
rep
->
translateSegmentNumber
(
nex
t
,
prevRep
);
}
else
if
(
first
&&
rep
->
getPlaylist
()
->
isLive
())
{
coun
t
=
rep
->
getLiveStartSegmentNumber
(
coun
t
);
nex
t
=
rep
->
getLiveStartSegmentNumber
(
nex
t
);
first
=
false
;
}
if
(
b_updated
)
{
if
(
!
rep
->
consistentSegmentNumber
())
curRepresentation
->
pruneBySegmentNumber
(
c
ount
);
curRepresentation
->
scheduleNextUpdate
(
c
ount
);
curRepresentation
->
pruneBySegmentNumber
(
c
urNumber
);
curRepresentation
->
scheduleNextUpdate
(
c
urNumber
);
}
if
(
!
init_sent
)
...
...
@@ -157,7 +157,7 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionM
init_sent
=
true
;
segment
=
rep
->
getSegment
(
BaseRepresentation
::
INFOTYPE_INIT
);
if
(
segment
)
return
segment
->
toChunk
(
coun
t
,
rep
,
connManager
);
return
segment
->
toChunk
(
nex
t
,
rep
,
connManager
);
}
if
(
!
index_sent
)
...
...
@@ -165,11 +165,11 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionM
index_sent
=
true
;
segment
=
rep
->
getSegment
(
BaseRepresentation
::
INFOTYPE_INDEX
);
if
(
segment
)
return
segment
->
toChunk
(
coun
t
,
rep
,
connManager
);
return
segment
->
toChunk
(
nex
t
,
rep
,
connManager
);
}
bool
b_gap
=
false
;
segment
=
rep
->
getNextSegment
(
BaseRepresentation
::
INFOTYPE_MEDIA
,
count
,
&
coun
t
,
&
b_gap
);
segment
=
rep
->
getNextSegment
(
BaseRepresentation
::
INFOTYPE_MEDIA
,
next
,
&
nex
t
,
&
b_gap
);
if
(
!
segment
)
{
reset
();
...
...
@@ -183,7 +183,7 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionM
initializing
=
false
;
}
SegmentChunk
*
chunk
=
segment
->
toChunk
(
coun
t
,
rep
,
connManager
);
SegmentChunk
*
chunk
=
segment
->
toChunk
(
nex
t
,
rep
,
connManager
);
/* We need to check segment/chunk format changes, as we can't rely on representation's (HLS)*/
if
(
chunk
&&
format
!=
chunk
->
getStreamFormat
())
...
...
@@ -193,13 +193,16 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionM
}
/* Handle both implicit and explicit discontinuities */
if
(
(
b_gap
&&
coun
t
)
||
(
chunk
&&
chunk
->
discontinuity
)
)
if
(
(
b_gap
&&
nex
t
)
||
(
chunk
&&
chunk
->
discontinuity
)
)
{
notify
(
SegmentTrackerEvent
(
chunk
));
}
if
(
chunk
)
count
++
;
{
curNumber
=
next
;
next
++
;
}
return
chunk
;
}
...
...
@@ -229,13 +232,13 @@ void SegmentTracker::setPositionByNumber(uint64_t segnumber, bool restarted)
index_sent
=
false
;
init_sent
=
false
;
}
c
oun
t
=
segnumber
;
c
urNumber
=
nex
t
=
segnumber
;
}
mtime_t
SegmentTracker
::
getPlaybackTime
()
const
{
if
(
curRepresentation
)
return
curRepresentation
->
getPlaybackTimeBySegmentNumber
(
coun
t
);
return
curRepresentation
->
getPlaybackTimeBySegmentNumber
(
nex
t
);
else
return
0
;
}
...
...
@@ -246,7 +249,7 @@ mtime_t SegmentTracker::getMinAheadTime() const
if
(
!
rep
)
rep
=
logic
->
getNextRepresentation
(
adaptationSet
,
NULL
);
if
(
rep
)
return
rep
->
getMinAheadTime
(
c
ount
);
return
rep
->
getMinAheadTime
(
c
urNumber
);
return
0
;
}
...
...
@@ -259,8 +262,8 @@ void SegmentTracker::updateSelected()
{
if
(
curRepresentation
&&
curRepresentation
->
needsUpdate
())
{
curRepresentation
->
runLocalUpdates
(
getPlaybackTime
(),
c
ount
,
true
);
curRepresentation
->
scheduleNextUpdate
(
c
ount
);
curRepresentation
->
runLocalUpdates
(
getPlaybackTime
(),
c
urNumber
,
true
);
curRepresentation
->
scheduleNextUpdate
(
c
urNumber
);
}
}
...
...
modules/demux/adaptative/SegmentTracker.hpp
View file @
72267b16
...
...
@@ -111,7 +111,8 @@ namespace adaptative
bool
initializing
;
bool
index_sent
;
bool
init_sent
;
uint64_t
count
;
uint64_t
next
;
uint64_t
curNumber
;
StreamFormat
format
;
AbstractAdaptationLogic
*
logic
;
BaseAdaptationSet
*
adaptationSet
;
...
...
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