Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8135de8

Browse files
Issue #16686: Fixed a lot of bugs in audioop module.
* avgpp() and maxpp() no more crash on empty and 1-samples input fragment. They now work when peak-peak values are greater INT_MAX. * ratecv() no more crashes on empty input fragment. * Fixed an integer overflow in ratecv(). * Fixed an integer overflow in add() and bias() for 32-bit samples. * reverse(), lin2lin() and ratecv() no more lose precision for 32-bit samples. * max() and rms() no more returns negative result for 32-bit sample -0x80000000. * minmax() now returns correct max value for 32-bit sample -0x80000000. * avg(), mul(), tomono() and tostereo() now round negative result down and can return 32-bit sample -0x80000000. * add() now can return 32-bit sample -0x80000000.
2 parents aa20b00 + 01ad622 commit 8135de8

4 files changed

Lines changed: 435 additions & 286 deletions

File tree

Doc/library/audioop.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The module defines the following variables and functions:
3636

3737
Return a fragment which is the addition of the two samples passed as parameters.
3838
*width* is the sample width in bytes, either ``1``, ``2`` or ``4``. Both
39-
fragments should have the same length.
39+
fragments should have the same length. Samples are truncated in case of overflow.
4040

4141

4242
.. function:: adpcm2lin(adpcmfragment, width, state)
@@ -67,7 +67,7 @@ The module defines the following variables and functions:
6767
.. function:: bias(fragment, width, bias)
6868

6969
Return a fragment that is the original fragment with a bias added to each
70-
sample.
70+
sample. Samples wrap around in case of overflow.
7171

7272

7373
.. function:: cross(fragment, width)
@@ -175,7 +175,7 @@ The module defines the following variables and functions:
175175
.. function:: mul(fragment, width, factor)
176176

177177
Return a fragment that has all samples in the original fragment multiplied by
178-
the floating-point value *factor*. Overflow is silently ignored.
178+
the floating-point value *factor*. Samples are truncated in case of overflow.
179179

180180

181181
.. function:: ratecv(fragment, width, nchannels, inrate, outrate, state[, weightA[, weightB]])

0 commit comments

Comments
 (0)