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
4bf1e07a
Commit
4bf1e07a
authored
Dec 29, 2015
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: wait segments when starving
parent
0579ca71
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
2 deletions
+31
-2
modules/demux/adaptative/PlaylistManager.cpp
modules/demux/adaptative/PlaylistManager.cpp
+11
-1
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
+3
-0
modules/demux/adaptative/Streams.hpp
modules/demux/adaptative/Streams.hpp
+6
-1
No files found.
modules/demux/adaptative/PlaylistManager.cpp
View file @
4bf1e07a
...
...
@@ -159,7 +159,12 @@ AbstractStream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
}
AbstractStream
::
status
i_ret
=
st
->
demux
(
nzdeadline
,
send
);
if
(
i_ret
==
AbstractStream
::
status_buffering
)
if
(
i_ret
==
AbstractStream
::
status_buffering_ahead
||
i_return
==
AbstractStream
::
status_buffering_ahead
)
{
i_return
=
AbstractStream
::
status_buffering_ahead
;
}
else
if
(
i_ret
==
AbstractStream
::
status_buffering
)
{
i_return
=
AbstractStream
::
status_buffering
;
}
...
...
@@ -332,6 +337,7 @@ int PlaylistManager::doDemux(int64_t increment)
case
AbstractStream
::
status_eof
:
return
VLC_DEMUXER_EOF
;
case
AbstractStream
::
status_buffering
:
case
AbstractStream
::
status_buffering_ahead
:
break
;
case
AbstractStream
::
status_dis
:
case
AbstractStream
::
status_eop
:
...
...
@@ -355,6 +361,10 @@ int PlaylistManager::doDemux(int64_t increment)
failedupdates
++
;
}
/* Live starved and update still not there ? */
if
(
status
==
AbstractStream
::
status_buffering_ahead
&&
needsUpdate
())
msleep
(
CLOCK_FREQ
/
20
);
/* Ugly */
return
VLC_DEMUXER_SUCCESS
;
}
...
...
modules/demux/adaptative/SegmentTracker.cpp
View file @
4bf1e07a
...
...
@@ -72,6 +72,16 @@ void SegmentTracker::setAdaptationLogic(AbstractAdaptationLogic *logic_)
registerListener
(
logic
);
}
bool
SegmentTracker
::
segmentsListReady
()
const
{
BaseRepresentation
*
rep
=
curRepresentation
;
if
(
!
rep
)
rep
=
logic
->
getNextRepresentation
(
adaptationSet
,
NULL
);
if
(
rep
&&
rep
->
getPlaylist
()
->
isLive
())
return
rep
->
getMinAheadTime
((
count
)
?
count
-
1
:
count
)
>
0
;
return
true
;
}
void
SegmentTracker
::
reset
()
{
notify
(
SegmentTrackerEvent
(
curRepresentation
,
NULL
));
...
...
modules/demux/adaptative/SegmentTracker.hpp
View file @
4bf1e07a
...
...
@@ -95,6 +95,7 @@ namespace adaptative
~
SegmentTracker
();
void
setAdaptationLogic
(
AbstractAdaptationLogic
*
);
bool
segmentsListReady
()
const
;
void
reset
();
SegmentChunk
*
getNextChunk
(
bool
,
HTTPConnectionManager
*
);
bool
setPositionByTime
(
mtime_t
,
bool
,
bool
);
...
...
modules/demux/adaptative/Streams.cpp
View file @
4bf1e07a
...
...
@@ -245,6 +245,9 @@ AbstractStream::status AbstractStream::demux(mtime_t nz_deadline, bool send)
if
(
nz_deadline
+
VLC_TS_0
>
getBufferingLevel
())
/* not already demuxed */
{
if
(
!
segmentTracker
->
segmentsListReady
())
/* Live Streams */
return
AbstractStream
::
status_buffering_ahead
;
/* need to read, demuxer still buffering, ... */
if
(
demuxer
->
demux
(
nz_deadline
)
!=
VLC_DEMUXER_SUCCESS
)
{
...
...
modules/demux/adaptative/Streams.hpp
View file @
4bf1e07a
...
...
@@ -73,7 +73,12 @@ namespace adaptative
bool
isSelected
()
const
;
virtual
bool
reactivate
(
mtime_t
);
bool
isDisabled
()
const
;
typedef
enum
{
status_eof
,
status_eop
,
status_dis
,
status_buffering
,
status_demuxed
}
status
;
typedef
enum
{
status_eof
,
status_eop
,
status_dis
,
status_buffering
,
status_buffering_ahead
,
/* Special case for live waiting new segments */
status_demuxed
}
status
;
status
demux
(
mtime_t
,
bool
);
virtual
bool
setPosition
(
mtime_t
,
bool
);
mtime_t
getPlaybackTime
()
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