Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
a9288be1
Commit
a9288be1
authored
Apr 29, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/demux/avi/avi.c: fixed infinite loop when seeking in broken/incomplete files.
parent
8b5a848f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
modules/demux/avi/avi.c
modules/demux/avi/avi.c
+23
-20
No files found.
modules/demux/avi/avi.c
View file @
a9288be1
...
...
@@ -740,7 +740,7 @@ static int Demux_Seekable( demux_t *p_demux )
if
(
!
(
i_loop_count
%
(
1024
*
10
))
)
msg_Warn
(
p_demux
,
"do
es
n't seem to find any data..."
);
"don't seem to find any data..."
);
}
continue
;
}
...
...
@@ -1046,10 +1046,8 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
unsigned
int
i_stream
;
msg_Dbg
(
p_demux
,
"seek requested: "
I64Fd
" secondes %d%%"
,
i_date
/
1000000
,
i_percent
);
msg_Dbg
(
p_demux
,
"seek requested: "
I64Fd
" secondes %d%%"
,
i_date
/
1000000
,
i_percent
);
if
(
p_sys
->
b_seekable
)
{
...
...
@@ -1059,8 +1057,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
int64_t
i_pos
;
/* use i_percent to create a true i_date */
msg_Warn
(
p_demux
,
"mmh, seeking without index at %d%%"
msg_Warn
(
p_demux
,
"mmh, seeking without index at %d%%"
" work only for interleaved file"
,
i_percent
);
if
(
i_percent
>=
100
)
{
...
...
@@ -1070,8 +1067,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
i_percent
=
__MAX
(
i_percent
,
0
);
/* try to find chunk that is at i_percent or the file */
i_pos
=
__MAX
(
i_percent
*
stream_Size
(
p_demux
->
s
)
/
100
,
i_pos
=
__MAX
(
i_percent
*
stream_Size
(
p_demux
->
s
)
/
100
,
p_sys
->
i_movi_begin
);
/* search first selected stream */
for
(
i_stream
=
0
,
p_stream
=
NULL
;
...
...
@@ -1090,9 +1086,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
}
/* be sure that the index exist */
if
(
AVI_StreamChunkSet
(
p_demux
,
i_stream
,
0
)
)
if
(
AVI_StreamChunkSet
(
p_demux
,
i_stream
,
0
)
)
{
msg_Warn
(
p_demux
,
"cannot seek"
);
return
(
-
1
);
...
...
@@ -1109,6 +1103,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
return
(
-
1
);
}
}
i_date
=
AVI_GetPTS
(
p_stream
);
/* TODO better support for i_samplesize != 0 */
msg_Dbg
(
p_demux
,
"estimate date "
I64Fd
,
i_date
);
...
...
@@ -1343,11 +1338,11 @@ static mtime_t AVI_GetPTS( avi_track_t *tk )
}
}
static
int
AVI_StreamChunkFind
(
demux_t
*
p_demux
,
unsigned
int
i_stream
)
static
int
AVI_StreamChunkFind
(
demux_t
*
p_demux
,
unsigned
int
i_stream
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
avi_packet_t
avi_pk
;
int
i_loop_count
=
0
;
/* find first chunk of i_stream that isn't in index */
...
...
@@ -1366,10 +1361,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
for
(
;;
)
{
if
(
p_demux
->
b_die
)
{
return
VLC_EGENERIC
;
}
if
(
p_demux
->
b_die
)
return
VLC_EGENERIC
;
if
(
AVI_PacketGetHeader
(
p_demux
,
&
avi_pk
)
)
{
...
...
@@ -1383,6 +1375,18 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
{
return
VLC_EGENERIC
;
}
/* Prevents from eating all the CPU with broken files.
* This value should be low enough so that it doesn't
* affect the reading speed too much. */
if
(
!
(
++
i_loop_count
%
1024
)
)
{
if
(
p_demux
->
b_die
)
return
VLC_EGENERIC
;
msleep
(
10000
);
if
(
!
(
i_loop_count
%
(
1024
*
10
))
)
msg_Warn
(
p_demux
,
"don't seem to find any data..."
);
}
}
else
{
...
...
@@ -1412,8 +1416,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
/* be sure that i_ck will be a valid index entry */
static
int
AVI_StreamChunkSet
(
demux_t
*
p_demux
,
unsigned
int
i_stream
,
static
int
AVI_StreamChunkSet
(
demux_t
*
p_demux
,
unsigned
int
i_stream
,
unsigned
int
i_ck
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
...
...
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