Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
2e4d57cf
Commit
2e4d57cf
authored
Aug 18, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed flac demuxer segfault (/0) when seektable is empty.
parent
9aba8655
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
modules/demux/flac.c
modules/demux/flac.c
+22
-15
No files found.
modules/demux/flac.c
View file @
2e4d57cf
...
@@ -283,10 +283,7 @@ static int64_t ControlGetTime( demux_t *p_demux )
...
@@ -283,10 +283,7 @@ static int64_t ControlGetTime( demux_t *p_demux )
static
int
ControlSetTime
(
demux_t
*
p_demux
,
int64_t
i_time
)
static
int
ControlSetTime
(
demux_t
*
p_demux
,
int64_t
i_time
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
int64_t
i_next_time
;
int64_t
i_next_offset
;
int64_t
i_delta_time
;
int64_t
i_delta_time
;
int64_t
i_delta_offset
;
bool
b_seekable
;
bool
b_seekable
;
int
i
;
int
i
;
...
@@ -302,33 +299,43 @@ static int ControlSetTime( demux_t *p_demux, int64_t i_time )
...
@@ -302,33 +299,43 @@ static int ControlSetTime( demux_t *p_demux, int64_t i_time )
if
(
p_sys
->
seekpoint
[
i
]
->
i_time_offset
<=
i_time
)
if
(
p_sys
->
seekpoint
[
i
]
->
i_time_offset
<=
i_time
)
break
;
break
;
}
}
if
(
i
+
1
<
p_sys
->
i_seekpoint
)
{
i_next_time
=
p_sys
->
seekpoint
[
i
+
1
]
->
i_time_offset
;
i_next_offset
=
p_sys
->
seekpoint
[
i
+
1
]
->
i_byte_offset
;
}
else
{
i_next_time
=
p_sys
->
i_length
;
i_next_offset
=
stream_Size
(
p_demux
->
s
)
-
p_sys
->
i_data_pos
;
}
i_delta_time
=
i_time
-
p_sys
->
seekpoint
[
i
]
->
i_time_offset
;
i_delta_time
=
i_time
-
p_sys
->
seekpoint
[
i
]
->
i_time_offset
;
i_delta_offset
=
(
i_next_offset
-
p_sys
->
seekpoint
[
i
]
->
i_byte_offset
)
*
i_delta_time
/
(
p_sys
->
seekpoint
[
i
+
1
]
->
i_time_offset
-
p_sys
->
seekpoint
[
i
]
->
i_time_offset
);
/* XXX We do exact seek if it's not too far away(45s) */
/* XXX We do exact seek if it's not too far away(45s) */
if
(
i_delta_time
<
45
*
INT64_C
(
1000000
)
)
if
(
i_delta_time
<
45
*
INT64_C
(
1000000
)
)
{
{
if
(
stream_Seek
(
p_demux
->
s
,
p_sys
->
seekpoint
[
i
]
->
i_byte_offset
+
p_sys
->
i_data_pos
)
)
if
(
stream_Seek
(
p_demux
->
s
,
p_sys
->
seekpoint
[
i
]
->
i_byte_offset
+
p_sys
->
i_data_pos
)
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
p_sys
->
i_time_offset
=
p_sys
->
seekpoint
[
i
]
->
i_time_offset
-
p_sys
->
i_pts
;
p_sys
->
i_time_offset
=
p_sys
->
seekpoint
[
i
]
->
i_time_offset
-
p_sys
->
i_pts
;
p_sys
->
i_pts_start
=
p_sys
->
i_pts
+
i_delta_time
;
p_sys
->
i_pts_start
=
p_sys
->
i_pts
+
i_delta_time
;
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_NEXT_DISPLAY_TIME
,
p_sys
->
p_es
,
p_sys
->
i_pts_start
);
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_NEXT_DISPLAY_TIME
,
p_sys
->
p_es
,
p_sys
->
i_pts_start
);
}
}
else
else
{
{
int64_t
i_delta_offset
;
int64_t
i_next_time
;
int64_t
i_next_offset
;
if
(
i
+
1
<
p_sys
->
i_seekpoint
)
{
i_next_time
=
p_sys
->
seekpoint
[
i
+
1
]
->
i_time_offset
;
i_next_offset
=
p_sys
->
seekpoint
[
i
+
1
]
->
i_byte_offset
;
}
else
{
i_next_time
=
p_sys
->
i_length
;
i_next_offset
=
stream_Size
(
p_demux
->
s
)
-
p_sys
->
i_data_pos
;
}
i_delta_offset
=
0
;
if
(
i_next_time
-
p_sys
->
seekpoint
[
i
]
->
i_time_offset
>
0
)
i_delta_offset
=
(
i_next_offset
-
p_sys
->
seekpoint
[
i
]
->
i_byte_offset
)
*
i_delta_time
/
(
i_next_time
-
p_sys
->
seekpoint
[
i
]
->
i_time_offset
);
if
(
stream_Seek
(
p_demux
->
s
,
p_sys
->
seekpoint
[
i
]
->
i_byte_offset
+
p_sys
->
i_data_pos
+
i_delta_offset
)
)
if
(
stream_Seek
(
p_demux
->
s
,
p_sys
->
seekpoint
[
i
]
->
i_byte_offset
+
p_sys
->
i_data_pos
+
i_delta_offset
)
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
p_sys
->
i_pts_start
=
p_sys
->
i_pts
;
p_sys
->
i_pts_start
=
p_sys
->
i_pts
;
p_sys
->
i_time_offset
=
(
p_sys
->
seekpoint
[
i
]
->
i_time_offset
+
i_delta_time
)
-
p_sys
->
i_pts
;
p_sys
->
i_time_offset
=
(
p_sys
->
seekpoint
[
i
]
->
i_time_offset
+
i_delta_time
)
-
p_sys
->
i_pts
;
}
}
...
...
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