Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
f831d6e8
Commit
f831d6e8
authored
Sep 01, 2006
by
yanmorin
Browse files
Remove segfault with float and mic/speaker < 100
parent
479ff3e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/audio/ringbuffer.cpp
View file @
f831d6e8
...
...
@@ -92,9 +92,9 @@ RingBuffer::Put(void* buffer, int toCopy, unsigned short volume) {
// put the data inside the buffer.
if
(
volume
!=
100
)
{
SFLDataFormat
*
s
rc16
=
(
SFLDataFormat
*
)
src
;
int
int16
le
n
=
(
block
>>
1
);
for
(
int
i
=
0
;
i
<
int16
le
n
;
i
++
)
{
s
rc16
[
i
]
=
s
rc16
[
i
]
*
volume
/
100
;
}
SFLDataFormat
*
s
tart
=
(
SFLDataFormat
*
)
src
;
int
nbSamp
le
=
block
/
sizeof
(
SFLDataFormat
);
for
(
int
i
=
0
;
i
<
nbSamp
le
;
i
++
)
{
s
tart
[
i
]
=
s
tart
[
i
]
*
volume
/
100
;
}
}
// bcopy(src, dest, len)
//fprintf(stderr, "has %d put %d\t", len, block);
...
...
@@ -143,8 +143,8 @@ RingBuffer::Get(void *buffer, int toCopy, unsigned short volume) {
if
(
volume
!=
100
)
{
SFLDataFormat
*
start
=
(
SFLDataFormat
*
)(
mBuffer
+
mStart
);
int
int16
le
n
=
(
block
>>
1
);
for
(
int
i
=
0
;
i
<
int16
le
n
;
i
++
)
{
start
[
i
]
=
start
[
i
]
*
volume
/
100
;
}
int
nbSamp
le
=
block
/
sizeof
(
SFLDataFormat
);
for
(
int
i
=
0
;
i
<
nbSamp
le
;
i
++
)
{
start
[
i
]
=
start
[
i
]
*
volume
/
100
;
}
}
// bcopy(src, dest, len)
bcopy
(
mBuffer
+
mStart
,
dest
,
block
);
...
...
Write
Preview
Supports
Markdown
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