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
76ece833
Commit
76ece833
authored
May 07, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: dash: use demux increments for pcr updates
should appear smoother
parent
0335f634
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
29 deletions
+70
-29
modules/demux/adaptative/PlaylistManager.cpp
modules/demux/adaptative/PlaylistManager.cpp
+13
-4
modules/demux/adaptative/PlaylistManager.h
modules/demux/adaptative/PlaylistManager.h
+3
-2
modules/demux/adaptative/Streams.cpp
modules/demux/adaptative/Streams.cpp
+18
-2
modules/demux/adaptative/Streams.hpp
modules/demux/adaptative/Streams.hpp
+3
-1
modules/demux/dash/dash.cpp
modules/demux/dash/dash.cpp
+32
-20
modules/demux/dash/dash.hpp
modules/demux/dash/dash.hpp
+1
-0
No files found.
modules/demux/adaptative/PlaylistManager.cpp
View file @
76ece833
...
...
@@ -112,16 +112,25 @@ bool PlaylistManager::start(demux_t *demux)
return
true
;
}
size_t
PlaylistManager
::
read
(
)
Streams
::
Stream
::
status
PlaylistManager
::
demux
(
mtime_t
nzdeadline
)
{
size_t
i_ret
=
0
;
Streams
::
Stream
::
status
i_return
=
Streams
::
Stream
::
status_demuxed
;
for
(
int
type
=
0
;
type
<
Streams
::
count
;
type
++
)
{
if
(
!
streams
[
type
])
continue
;
i_ret
+=
streams
[
type
]
->
read
(
conManager
);
Streams
::
Stream
::
status
i_ret
=
streams
[
type
]
->
demux
(
conManager
,
nzdeadline
);
if
(
i_ret
<
Streams
::
Stream
::
status_eof
)
return
i_ret
;
else
if
(
i_ret
==
Streams
::
Stream
::
status_buffering
)
i_return
=
Streams
::
Stream
::
status_buffering
;
}
return
i_ret
;
return
i_return
;
}
mtime_t
PlaylistManager
::
getPCR
()
const
...
...
modules/demux/adaptative/PlaylistManager.h
View file @
76ece833
...
...
@@ -48,8 +48,9 @@ namespace adaptative
AbstractAdaptationLogic
::
LogicType
type
,
stream_t
*
stream
);
virtual
~
PlaylistManager
();
bool
start
(
demux_t
*
);
size_t
read
();
bool
start
(
demux_t
*
);
Streams
::
Stream
::
status
demux
(
mtime_t
);
mtime_t
getDuration
()
const
;
mtime_t
getPCR
()
const
;
int
getGroup
()
const
;
...
...
modules/demux/adaptative/Streams.cpp
View file @
76ece833
...
...
@@ -151,6 +151,22 @@ bool Stream::seekAble() const
return
(
output
&&
output
->
seekAble
());
}
Stream
::
status
Stream
::
demux
(
HTTPConnectionManager
*
connManager
,
mtime_t
nz_deadline
)
{
if
(
nz_deadline
+
VLC_TS_0
>
output
->
getPCR
())
/* not already demuxed */
{
/* need to read, demuxer still buffering, ... */
if
(
read
(
connManager
)
<=
0
)
return
Stream
::
status_eof
;
if
(
nz_deadline
+
VLC_TS_0
>
output
->
getPCR
())
/* need to read more */
return
Stream
::
status_buffering
;
}
output
->
sendToDecoder
(
nz_deadline
);
return
Stream
::
status_demuxed
;
}
size_t
Stream
::
read
(
HTTPConnectionManager
*
connManager
)
{
Chunk
*
chunk
=
getChunk
();
...
...
@@ -216,7 +232,6 @@ size_t Stream::read(HTTPConnectionManager *connManager)
readsize
=
block
->
i_buffer
;
output
->
pushBlock
(
block
);
output
->
sendToDecoder
(
INT64_MAX
-
VLC_TS_0
);
return
readsize
;
}
...
...
@@ -239,7 +254,7 @@ AbstractStreamOutput::AbstractStreamOutput(demux_t *demux)
realdemux
=
demux
;
demuxstream
=
NULL
;
pcr
=
VLC_TS_0
;
group
=
-
1
;
group
=
0
;
seekable
=
true
;
fakeesout
=
new
es_out_t
;
...
...
@@ -387,6 +402,7 @@ void AbstractStreamOutput::esOutDel(es_out_t *fakees, es_out_id_t *p_es)
{
if
((
*
it
)
->
es_id
==
p_es
)
{
me
->
sendToDecoder
(
INT64_MAX
-
VLC_TS_0
);
delete
*
it
;
me
->
queues
.
erase
(
it
);
break
;
...
...
modules/demux/adaptative/Streams.hpp
View file @
76ece833
...
...
@@ -66,13 +66,15 @@ namespace adaptative
int
getGroup
()
const
;
int
esCount
()
const
;
bool
seekAble
()
const
;
size_t
read
(
HTTPConnectionManager
*
);
typedef
enum
{
status_eof
,
status_buffering
,
status_demuxed
}
status
;
status
demux
(
HTTPConnectionManager
*
,
mtime_t
);
bool
setPosition
(
mtime_t
,
bool
);
mtime_t
getPosition
()
const
;
private:
Chunk
*
getChunk
();
void
init
(
const
Type
,
const
Format
);
size_t
read
(
HTTPConnectionManager
*
);
Type
type
;
Format
format
;
AbstractStreamOutput
*
output
;
...
...
modules/demux/dash/dash.cpp
View file @
76ece833
...
...
@@ -157,6 +157,8 @@ static int Open(vlc_object_t *p_obj)
p_demux
->
pf_demux
=
Demux
;
p_demux
->
pf_control
=
Control
;
p_sys
->
i_nzpcr
=
0
;
msg_Dbg
(
p_obj
,
"opening mpd file (%s)"
,
p_demux
->
s
->
psz_path
);
return
VLC_SUCCESS
;
...
...
@@ -176,28 +178,30 @@ static void Close(vlc_object_t *p_obj)
/*****************************************************************************
* Callbacks:
*****************************************************************************/
#define DEMUX_INCREMENT (CLOCK_FREQ / 20)
static
int
Demux
(
demux_t
*
p_demux
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
if
(
p_sys
->
p_dashManager
->
read
()
>
0
)
{
if
(
p_sys
->
p_dashManager
->
esCount
()
)
{
mtime_t
pcr
=
p_sys
->
p_dashManager
->
getPCR
();
int
group
=
p_sys
->
p_dashManager
->
getGroup
();
if
(
group
>
0
)
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_GROUP_PCR
,
group
,
pcr
);
else
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
pcr
);
}
if
(
!
p_sys
->
p_dashManager
->
updatePlaylist
()
)
return
VLC_DEMUXER_EOF
;
return
VLC_DEMUXER_SUCCESS
;
Streams
::
Stream
::
status
status
=
p_sys
->
p_dashManager
->
demux
(
p_sys
->
i_nzpcr
+
DEMUX_INCREMENT
);
switch
(
status
)
{
case
Streams
:
:
Stream
::
status_eof
:
return
VLC_DEMUXER_EOF
;
case
Streams
:
:
Stream
::
status_buffering
:
break
;
case
Streams
:
:
Stream
::
status_demuxed
:
p_sys
->
i_nzpcr
+=
DEMUX_INCREMENT
;
int
group
=
p_sys
->
p_dashManager
->
getGroup
();
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_GROUP_PCR
,
group
,
VLC_TS_0
+
p_sys
->
i_nzpcr
);
break
;
}
else
if
(
!
p_sys
->
p_dashManager
->
updatePlaylist
()
)
return
VLC_DEMUXER_EOF
;
return
VLC_DEMUXER_SUCCESS
;
}
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
...
...
@@ -219,7 +223,7 @@ static int Control (demux_t *p_demux, int i_query, va_list args)
break
;
case
DEMUX_GET_TIME
:
*
(
va_arg
(
args
,
int64_t
*
))
=
p_sys
->
p_dashManager
->
getPCR
()
;
*
(
va_arg
(
args
,
int64_t
*
))
=
p_sys
->
i_nzpcr
;
break
;
case
DEMUX_GET_LENGTH
:
...
...
@@ -230,22 +234,30 @@ static int Control (demux_t *p_demux, int i_query, va_list args)
if
(
!
p_sys
->
p_dashManager
->
getDuration
())
return
VLC_EGENERIC
;
*
(
va_arg
(
args
,
double
*
))
=
(
double
)
p_sys
->
p_dashManager
->
getPCR
()
*
(
va_arg
(
args
,
double
*
))
=
(
double
)
p_sys
->
i_nzpcr
/
p_sys
->
p_dashManager
->
getDuration
();
break
;
case
DEMUX_SET_POSITION
:
{
int64_t
time
=
p_sys
->
p_dashManager
->
getDuration
()
*
va_arg
(
args
,
double
);
if
(
p_sys
->
p_mpd
->
isLive
()
||
!
p_sys
->
p_dashManager
->
getDuration
()
||
!
p_sys
->
p_dashManager
->
setPosition
(
p_sys
->
p_dashManager
->
getDuration
()
*
va_arg
(
args
,
double
)
))
!
p_sys
->
p_dashManager
->
setPosition
(
time
))
return
VLC_EGENERIC
;
p_sys
->
i_nzpcr
=
time
;
break
;
}
case
DEMUX_SET_TIME
:
{
int64_t
time
=
va_arg
(
args
,
int64_t
);
if
(
p_sys
->
p_mpd
->
isLive
()
||
!
p_sys
->
p_dashManager
->
setPosition
(
va_arg
(
args
,
int64_t
)
))
!
p_sys
->
p_dashManager
->
setPosition
(
time
))
return
VLC_EGENERIC
;
p_sys
->
i_nzpcr
=
time
;
break
;
}
case
DEMUX_GET_PTS_DELAY
:
*
va_arg
(
args
,
int64_t
*
)
=
INT64_C
(
1000
)
*
...
...
modules/demux/dash/dash.hpp
View file @
76ece833
...
...
@@ -23,4 +23,5 @@ struct demux_sys_t
{
dash
::
DASHManager
*
p_dashManager
;
dash
::
mpd
::
MPD
*
p_mpd
;
mtime_t
i_nzpcr
;
};
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