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
0b9f3696
Commit
0b9f3696
authored
Jul 15, 2016
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: ps: check return value of stream_seek
parent
e2371925
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
modules/demux/mpeg/ps.c
modules/demux/mpeg/ps.c
+18
-10
No files found.
modules/demux/mpeg/ps.c
View file @
0b9f3696
...
...
@@ -239,13 +239,13 @@ static int Demux2( demux_t *p_demux, bool b_end )
return
1
;
}
static
void
FindLength
(
demux_t
*
p_demux
)
static
bool
FindLength
(
demux_t
*
p_demux
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int64_t
i_current_pos
=
-
1
,
i_size
=
0
,
i_end
=
0
;
if
(
!
var_CreateGetBool
(
p_demux
,
"ps-trust-timestamps"
)
)
return
;
return
true
;
if
(
p_sys
->
i_length
==
-
1
)
/* First time */
{
...
...
@@ -258,11 +258,15 @@ static void FindLength( demux_t *p_demux )
/* Check end */
i_size
=
stream_Size
(
p_demux
->
s
);
i_end
=
VLC_CLIP
(
i_size
,
0
,
200000
);
stream_Seek
(
p_demux
->
s
,
i_size
-
i_end
);
i
=
0
;
while
(
i
<
400
&&
Demux2
(
p_demux
,
true
)
>
0
)
i
++
;
if
(
i_current_pos
>=
0
)
stream_Seek
(
p_demux
->
s
,
i_current_pos
);
if
(
stream_Seek
(
p_demux
->
s
,
i_size
-
i_end
)
==
VLC_SUCCESS
)
{
i
=
0
;
while
(
i
<
400
&&
Demux2
(
p_demux
,
true
)
>
0
)
i
++
;
if
(
i_current_pos
>=
0
&&
stream_Seek
(
p_demux
->
s
,
i_current_pos
)
!=
VLC_SUCCESS
)
return
false
;
}
else
return
false
;
}
/* Find the longest track */
...
...
@@ -281,6 +285,7 @@ static void FindLength( demux_t *p_demux )
}
}
}
return
true
;
}
/*****************************************************************************
...
...
@@ -311,7 +316,10 @@ static int Demux( demux_t *p_demux )
p_sys
->
b_lost_sync
=
false
;
if
(
p_sys
->
i_length
<
0
&&
p_sys
->
b_seekable
)
FindLength
(
p_demux
);
{
if
(
!
FindLength
(
p_demux
)
)
return
VLC_DEMUXER_EGENERIC
;
}
if
(
(
p_pkt
=
ps_pkt_read
(
p_demux
->
s
,
i_code
)
)
==
NULL
)
{
...
...
@@ -533,8 +541,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
p_sys
->
i_current_pts
=
0
;
p_sys
->
i_last_scr
=
-
1
;
i_pos
*=
(
float
)
i64
/
(
float
)
i_now
;
stream_Seek
(
p_demux
->
s
,
i_pos
);
return
VLC_SUCCESS
;
return
stream_Seek
(
p_demux
->
s
,
i_pos
)
;
}
return
VLC_EGENERIC
;
...
...
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