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
1c6daf4c
Commit
1c6daf4c
authored
May 24, 2014
by
Tristan Matthews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
headphone: fix overflow buffer handling
Fixes #11502
parent
1aa472f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
modules/audio_filter/channel_mixer/headphone.c
modules/audio_filter/channel_mixer/headphone.c
+18
-16
No files found.
modules/audio_filter/channel_mixer/headphone.c
View file @
1c6daf4c
...
...
@@ -338,8 +338,9 @@ static void DoWork( filter_t * p_filter,
float
*
p_in
=
(
float
*
)
p_in_buf
->
p_buffer
;
float
*
p_out
;
float
*
p_overflow
;
float
*
p_slide
;
uint8_t
*
p_overflow
;
uint8_t
*
p_end_overflow
;
uint8_t
*
p_slide
;
size_t
i_overflow_size
;
/* in bytes */
size_t
i_out_size
;
/* in bytes */
...
...
@@ -355,32 +356,33 @@ static void DoWork( filter_t * p_filter,
i_out_size
=
p_out_buf
->
i_buffer
;
/* Slide the overflow buffer */
p_overflow
=
p_sys
->
p_overflow_buffer
;
p_overflow
=
(
uint8_t
*
)
p_sys
->
p_overflow_buffer
;
i_overflow_size
=
p_sys
->
i_overflow_buffer_size
;
p_end_overflow
=
p_overflow
+
i_overflow_size
;
memset
(
p_out
,
0
,
i_out_size
);
if
(
i_out_size
>
i_overflow_size
)
memcpy
(
p_out
,
p_overflow
,
i_overflow_size
);
else
memcpy
(
p_out
,
p_overflow
,
i_out_size
);
memcpy
(
p_out
,
p_overflow
,
__MIN
(
i_out_size
,
i_overflow_size
)
);
p_slide
=
p_sys
->
p_overflow_buffer
;
while
(
p_slide
<
p_
overflow
+
i_overflow_size
)
p_slide
=
(
uint8_t
*
)
p_sys
->
p_overflow_buffer
;
while
(
p_slide
<
p_
end_overflow
)
{
if
(
p_slide
+
i_out_size
<
p_overflow
+
i_overflow_size
)
size_t
i_bytes_copied
;
if
(
p_slide
+
i_out_size
<
p_end_overflow
)
{
memset
(
p_slide
,
0
,
i_out_size
);
if
(
p_slide
+
2
*
i_out_size
<
p_
overflow
+
i_overflow_size
)
memcpy
(
p_slide
,
p_slide
+
i_out_size
,
i_out_size
)
;
if
(
p_slide
+
2
*
i_out_size
<
p_
end_overflow
)
i_bytes_copied
=
i_out_size
;
else
memcpy
(
p_slide
,
p_slide
+
i_out_size
,
p_overflow
+
i_overflow_size
-
(
p_slide
+
i_out_size
)
);
i_bytes_copied
=
p_end_overflow
-
(
p_slide
+
i_out_size
);
memcpy
(
p_slide
,
p_slide
+
i_out_size
,
i_bytes_copied
);
}
else
{
memset
(
p_slide
,
0
,
p_overflow
+
i_overflow_size
-
p_slide
);
i_bytes_copied
=
p_end_overflow
-
p_slide
;
memset
(
p_slide
,
0
,
i_bytes_copied
);
}
p_slide
+=
i_
out_size
;
p_slide
+=
i_
bytes_copied
;
}
/* apply the atomic operations */
...
...
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