Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
9915a33f
Commit
9915a33f
authored
Jun 06, 2012
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/audio: fix size of copied samples.
Fixes sporadic segfaults with some filters.
parent
8d1de449
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
audio.c
libavfilter/audio.c
+6
-3
No files found.
libavfilter/audio.c
View file @
9915a33f
...
...
@@ -190,7 +190,7 @@ void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
/* prepare to copy the samples if the buffer has insufficient permissions */
if
((
dst
->
min_perms
&
samplesref
->
perms
)
!=
dst
->
min_perms
||
dst
->
rej_perms
&
samplesref
->
perms
)
{
int
i
,
planar
=
av_sample_fmt_is_planar
(
samplesref
->
format
);
int
i
,
size
,
planar
=
av_sample_fmt_is_planar
(
samplesref
->
format
);
int
planes
=
!
planar
?
1
:
av_get_channel_layout_nb_channels
(
samplesref
->
audio
->
channel_layout
);
...
...
@@ -204,10 +204,13 @@ void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
link
->
cur_buf
->
audio
->
sample_rate
=
samplesref
->
audio
->
sample_rate
;
/* Copy actual data into new samples buffer */
/* src can be larger than dst if it was allocated larger than necessary.
dst can be slightly larger due to extra alignment padding. */
size
=
FFMIN
(
samplesref
->
linesize
[
0
],
link
->
cur_buf
->
linesize
[
0
]);
for
(
i
=
0
;
samplesref
->
data
[
i
]
&&
i
<
8
;
i
++
)
memcpy
(
link
->
cur_buf
->
data
[
i
],
samplesref
->
data
[
i
],
s
amplesref
->
linesize
[
0
]
);
memcpy
(
link
->
cur_buf
->
data
[
i
],
samplesref
->
data
[
i
],
s
ize
);
for
(
i
=
0
;
i
<
planes
;
i
++
)
memcpy
(
link
->
cur_buf
->
extended_data
[
i
],
samplesref
->
extended_data
[
i
],
s
amplesref
->
linesize
[
0
]
);
memcpy
(
link
->
cur_buf
->
extended_data
[
i
],
samplesref
->
extended_data
[
i
],
s
ize
);
avfilter_unref_buffer
(
samplesref
);
}
else
...
...
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