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 )
...
@@ -740,7 +740,7 @@ static int Demux_Seekable( demux_t *p_demux )
if
(
!
(
i_loop_count
%
(
1024
*
10
))
)
if
(
!
(
i_loop_count
%
(
1024
*
10
))
)
msg_Warn
(
p_demux
,
msg_Warn
(
p_demux
,
"do
es
n't seem to find any data..."
);
"don't seem to find any data..."
);
}
}
continue
;
continue
;
}
}
...
@@ -1046,10 +1046,8 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
...
@@ -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
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
unsigned
int
i_stream
;
unsigned
int
i_stream
;
msg_Dbg
(
p_demux
,
msg_Dbg
(
p_demux
,
"seek requested: "
I64Fd
" secondes %d%%"
,
"seek requested: "
I64Fd
" secondes %d%%"
,
i_date
/
1000000
,
i_percent
);
i_date
/
1000000
,
i_percent
);
if
(
p_sys
->
b_seekable
)
if
(
p_sys
->
b_seekable
)
{
{
...
@@ -1059,8 +1057,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
...
@@ -1059,8 +1057,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
int64_t
i_pos
;
int64_t
i_pos
;
/* use i_percent to create a true i_date */
/* use i_percent to create a true i_date */
msg_Warn
(
p_demux
,
msg_Warn
(
p_demux
,
"mmh, seeking without index at %d%%"
"mmh, seeking without index at %d%%"
" work only for interleaved file"
,
i_percent
);
" work only for interleaved file"
,
i_percent
);
if
(
i_percent
>=
100
)
if
(
i_percent
>=
100
)
{
{
...
@@ -1070,8 +1067,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
...
@@ -1070,8 +1067,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
i_percent
=
__MAX
(
i_percent
,
0
);
i_percent
=
__MAX
(
i_percent
,
0
);
/* try to find chunk that is at i_percent or the file */
/* try to find chunk that is at i_percent or the file */
i_pos
=
__MAX
(
i_percent
*
i_pos
=
__MAX
(
i_percent
*
stream_Size
(
p_demux
->
s
)
/
100
,
stream_Size
(
p_demux
->
s
)
/
100
,
p_sys
->
i_movi_begin
);
p_sys
->
i_movi_begin
);
/* search first selected stream */
/* search first selected stream */
for
(
i_stream
=
0
,
p_stream
=
NULL
;
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 )
...
@@ -1090,9 +1086,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
}
}
/* be sure that the index exist */
/* be sure that the index exist */
if
(
AVI_StreamChunkSet
(
p_demux
,
if
(
AVI_StreamChunkSet
(
p_demux
,
i_stream
,
0
)
)
i_stream
,
0
)
)
{
{
msg_Warn
(
p_demux
,
"cannot seek"
);
msg_Warn
(
p_demux
,
"cannot seek"
);
return
(
-
1
);
return
(
-
1
);
...
@@ -1109,6 +1103,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
...
@@ -1109,6 +1103,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
return
(
-
1
);
return
(
-
1
);
}
}
}
}
i_date
=
AVI_GetPTS
(
p_stream
);
i_date
=
AVI_GetPTS
(
p_stream
);
/* TODO better support for i_samplesize != 0 */
/* TODO better support for i_samplesize != 0 */
msg_Dbg
(
p_demux
,
"estimate date "
I64Fd
,
i_date
);
msg_Dbg
(
p_demux
,
"estimate date "
I64Fd
,
i_date
);
...
@@ -1343,11 +1338,11 @@ static mtime_t AVI_GetPTS( avi_track_t *tk )
...
@@ -1343,11 +1338,11 @@ static mtime_t AVI_GetPTS( avi_track_t *tk )
}
}
}
}
static
int
AVI_StreamChunkFind
(
demux_t
*
p_demux
,
static
int
AVI_StreamChunkFind
(
demux_t
*
p_demux
,
unsigned
int
i_stream
)
unsigned
int
i_stream
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
avi_packet_t
avi_pk
;
avi_packet_t
avi_pk
;
int
i_loop_count
=
0
;
/* find first chunk of i_stream that isn't in index */
/* find first chunk of i_stream that isn't in index */
...
@@ -1366,10 +1361,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
...
@@ -1366,10 +1361,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
for
(
;;
)
for
(
;;
)
{
{
if
(
p_demux
->
b_die
)
if
(
p_demux
->
b_die
)
return
VLC_EGENERIC
;
{
return
VLC_EGENERIC
;
}
if
(
AVI_PacketGetHeader
(
p_demux
,
&
avi_pk
)
)
if
(
AVI_PacketGetHeader
(
p_demux
,
&
avi_pk
)
)
{
{
...
@@ -1383,6 +1375,18 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
...
@@ -1383,6 +1375,18 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
{
{
return
VLC_EGENERIC
;
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
else
{
{
...
@@ -1412,8 +1416,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
...
@@ -1412,8 +1416,7 @@ static int AVI_StreamChunkFind( demux_t *p_demux,
/* be sure that i_ck will be a valid index entry */
/* be sure that i_ck will be a valid index entry */
static
int
AVI_StreamChunkSet
(
demux_t
*
p_demux
,
static
int
AVI_StreamChunkSet
(
demux_t
*
p_demux
,
unsigned
int
i_stream
,
unsigned
int
i_stream
,
unsigned
int
i_ck
)
unsigned
int
i_ck
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
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