Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
40608ad1
Commit
40608ad1
authored
Jul 07, 2016
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptive: simplify first pcr handling
parent
2dcf76ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
20 deletions
+38
-20
modules/demux/adaptive/PlaylistManager.cpp
modules/demux/adaptive/PlaylistManager.cpp
+14
-14
modules/demux/adaptive/Streams.cpp
modules/demux/adaptive/Streams.cpp
+18
-2
modules/demux/adaptive/plumbing/CommandsQueue.cpp
modules/demux/adaptive/plumbing/CommandsQueue.cpp
+6
-4
No files found.
modules/demux/adaptive/PlaylistManager.cpp
View file @
40608ad1
...
...
@@ -208,8 +208,6 @@ AbstractStream::buffering_status PlaylistManager::bufferize(mtime_t i_nzdeadline
i_return
!=
AbstractStream
::
buffering_lessthanmin
/* prevents starting before buffering is reached */
)
{
demux
.
i_nzpcr
=
getFirstDTS
();
if
(
demux
.
i_nzpcr
==
VLC_TS_INVALID
)
demux
.
i_nzpcr
=
getPCR
();
}
vlc_mutex_unlock
(
&
demux
.
lock
);
...
...
@@ -265,30 +263,32 @@ void PlaylistManager::drain()
mtime_t
PlaylistManager
::
getPCR
()
const
{
mtime_t
pcr
=
VLC_TS_INVALID
;
mtime_t
min
pcr
=
VLC_TS_INVALID
;
std
::
vector
<
AbstractStream
*>::
const_iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
((
*
it
)
->
isDisabled
()
||
(
*
it
)
->
isDead
())
continue
;
if
(
pcr
==
VLC_TS_INVALID
||
pcr
>
(
*
it
)
->
getPCR
())
pcr
=
(
*
it
)
->
getPCR
();
const
mtime_t
pcr
=
(
*
it
)
->
getPCR
();
if
(
minpcr
==
VLC_TS_INVALID
)
minpcr
=
pcr
;
else
if
(
pcr
>
VLC_TS_INVALID
)
minpcr
=
std
::
min
(
minpcr
,
pcr
);
}
return
pcr
;
return
min
pcr
;
}
mtime_t
PlaylistManager
::
getFirstDTS
()
const
{
mtime_t
dts
=
VLC_TS_INVALID
;
mtime_t
min
dts
=
VLC_TS_INVALID
;
std
::
vector
<
AbstractStream
*>::
const_iterator
it
;
for
(
it
=
streams
.
begin
();
it
!=
streams
.
end
();
++
it
)
{
if
((
*
it
)
->
isDisabled
()
||
(
*
it
)
->
isDead
())
continue
;
if
(
dts
==
VLC_TS_INVALID
||
dts
>
(
*
it
)
->
getFirstDTS
())
dts
=
(
*
it
)
->
getFirstDTS
();
const
mtime_t
dts
=
(
*
it
)
->
getFirstDTS
();
if
(
mindts
==
VLC_TS_INVALID
)
mindts
=
dts
;
else
if
(
dts
>
VLC_TS_INVALID
)
mindts
=
std
::
min
(
mindts
,
dts
);
}
return
dts
;
return
min
dts
;
}
mtime_t
PlaylistManager
::
getDuration
()
const
...
...
modules/demux/adaptive/Streams.cpp
View file @
40608ad1
...
...
@@ -140,7 +140,10 @@ bool AbstractStream::isDead() const
mtime_t
AbstractStream
::
getPCR
()
const
{
return
commandsqueue
->
getPCR
();
vlc_mutex_lock
(
const_cast
<
vlc_mutex_t
*>
(
&
lock
));
mtime_t
pcr
=
(
dead
||
disabled
)
?
VLC_TS_INVALID
:
commandsqueue
->
getPCR
();
vlc_mutex_unlock
(
const_cast
<
vlc_mutex_t
*>
(
&
lock
));
return
pcr
;
}
mtime_t
AbstractStream
::
getMinAheadTime
()
const
...
...
@@ -152,7 +155,20 @@ mtime_t AbstractStream::getMinAheadTime() const
mtime_t
AbstractStream
::
getFirstDTS
()
const
{
return
commandsqueue
->
getFirstDTS
();
mtime_t
dts
;
vlc_mutex_lock
(
const_cast
<
vlc_mutex_t
*>
(
&
lock
));
if
(
dead
||
disabled
)
{
dts
=
VLC_TS_INVALID
;
}
else
{
dts
=
commandsqueue
->
getFirstDTS
();
if
(
dts
==
VLC_TS_INVALID
)
dts
=
commandsqueue
->
getPCR
();
}
vlc_mutex_unlock
(
const_cast
<
vlc_mutex_t
*>
(
&
lock
));
return
dts
;
}
int
AbstractStream
::
esCount
()
const
...
...
modules/demux/adaptive/plumbing/CommandsQueue.cpp
View file @
40608ad1
...
...
@@ -376,19 +376,21 @@ mtime_t CommandsQueue::getBufferingLevel() const
mtime_t
CommandsQueue
::
getFirstDTS
()
const
{
mtime_t
i_dts
=
VLC_TS_INVALID
;
std
::
list
<
AbstractCommand
*>::
const_iterator
it
;
vlc_mutex_lock
(
const_cast
<
vlc_mutex_t
*>
(
&
lock
));
mtime_t
i_firstdts
=
pcr
;
for
(
it
=
commands
.
begin
();
it
!=
commands
.
end
();
++
it
)
{
if
(
(
*
it
)
->
getTime
()
>
VLC_TS_INVALID
)
const
mtime_t
i_dts
=
(
*
it
)
->
getTime
();
if
(
i_dts
>
VLC_TS_INVALID
)
{
i_dts
=
(
*
it
)
->
getTime
();
if
(
i_dts
<
i_firstdts
||
i_firstdts
==
VLC_TS_INVALID
)
i_firstdts
=
i_dts
;
break
;
}
}
vlc_mutex_unlock
(
const_cast
<
vlc_mutex_t
*>
(
&
lock
));
return
i_dts
;
return
i_
first
dts
;
}
mtime_t
CommandsQueue
::
getPCR
()
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