Commit Graph

4439 Commits

Author SHA1 Message Date
Martijn van Beurden c4cddca335 Rearrange, use mutexes instead of semaphores at some points
Also, don't rely on pthread_cancel anymore
2023-09-22 21:10:15 +02:00
Martijn van Beurden 9abbcd4184 Enable main thread to code frame instead of idle 2023-09-22 21:10:15 +02:00
Martijn van Beurden df5dc22cbf Move MD5 calculation from main thread to workers 2023-09-22 21:10:15 +02:00
Martijn van Beurden d41127f860 Make it possible for threads to leapfrog each other 2023-09-22 21:10:15 +02:00
Martijn van Beurden a4b8b0f0f2 Queue two tasks per thread
This should improve multithreading throughput
2023-09-22 21:10:15 +02:00
Martijn van Beurden 2dfd4dad60 Try to get multithreading working on MacOS 2023-09-22 21:10:15 +02:00
Martijn van Beurden cb190cc0a8 Add multithreading to tests 2023-09-22 21:10:15 +02:00
Martijn van Beurden 37194bb4bd Add multithreading option to flac command line tool 2023-09-22 21:10:15 +02:00
Martijn van Beurden c29735769c Add multithreaded fuzzing to fuzzer_encoder_v2 2023-09-22 21:10:15 +02:00
Martijn van Beurden 2a3f1efebc Mute output of fuzzer_encoder_v2 2023-09-22 21:10:15 +02:00
Martijn van Beurden acf6f8ff11 Add multithreading to libFLAC 2023-09-22 21:10:15 +02:00
Martijn van Beurden 4201109057 Pass threadctx to calls that will need that 2023-09-22 21:10:15 +02:00
Martijn van Beurden 0780ef0ecf Move thread stuff to own struct 2023-09-22 21:10:15 +02:00
Martijn van Beurden 68d01aaea5 Add checking for pthread to configure 2023-09-22 21:10:15 +02:00
Lee Carré 2a29eae030
Documentation (man/flac.md); fix typo (#644)
Section: `Apodization functions`

From:

> For partial_tukey(n) and punchout_tukey(n), […] The use of this is
> that different parts of a block are ignored as the might contain
> transients which are hard to predict anyway. […]

to (emphasis added only in this summary, not in the source):

> For partial_tukey(n) and punchout_tukey(n), […] The use of this is
> that different parts of a block are ignored as the**y** might contain
> transients which are hard to predict anyway. […]
2023-09-03 20:09:35 +02:00
manx 31ccd3df31
Use correct argument type for _BitScanReverse and _BitScanReverse64. (#638)
_BitScanReverse and _BitScanReverse64 are documented to take an `unsigned long *` as the first argument (see <https://learn.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=msvc-170>), however libFLAC used `uint32_t` which happens to be `unsigned int`.

This silences Clang warning `incompatible pointer types passing 'uint32_t *' (aka 'unsigned int *') to parameter of type 'unsigned long *' [-Wincompatible-pointer-types]`.

Fixes https://github.com/xiph/flac/issues/637
See also https://github.com/xiph/flac/pull/638 for comments
2023-07-27 12:11:07 +02:00
Martijn van Beurden 6c126e9308
Limit the number of clock() calls
The overhead of calling clock() when encoding/decoding very small
frames turned out to be very large, for framesize 16 these syscalls
took over half the execution time. This commit only calls clock()
when at least 10.000 samples have been encoded or 25.000 samples
have been decoded since the last call to clock()
2023-07-07 20:31:23 +02:00
Martijn van Beurden 28e4f0528c
Release FLAC 1.4.3 2023-06-23 09:17:08 +02:00
Martijn van Beurden c7fc1768e8
Fix library version numbers/sonames 2023-06-21 17:09:24 +02:00
Martijn van Beurden 08f8af0845
Improve on "Check for got_stream_info instead of samplerate being 0"
This improves on commit 6db29d1. It turns that commit broke some
parsing, this fixes it
2023-06-18 20:32:27 +02:00
Martijn van Beurden d80e574451
Explain use of errno with callbacks 2023-06-16 06:46:57 +02:00
Martijn van Beurden 4f9be8620b
Add github action to check against flac test files 2023-06-15 19:46:38 +02:00
Martijn van Beurden e00d9b881f
Update copyright year and maintainer status 2023-06-06 22:08:24 +02:00
Martijn van Beurden 7f89a74cb2
Slim down CI 2023-06-06 18:03:32 +02:00
Martijn van Beurden c0fc3c73e2
Update changelog 2023-06-06 09:30:50 +02:00
Martijn van Beurden fd890034a5
Fix compression level 8 in API docs 2023-06-01 19:16:03 +02:00
Martijn van Beurden 6a9c1664b3
Check that seektable length > 0 2023-06-01 16:50:27 +02:00
Martijn van Beurden d6974b9702
Remove sector align option
This option has been deprecated since FLAC 1.3.0.
2023-05-31 21:49:44 +02:00
Martijn van Beurden 1619af5a36
Update changelog and library version numbers 2023-05-30 07:41:35 +02:00
Martijn van Beurden 0b8a271b3e
Fix version number display on Windows
This adds windows-specific version information to build objects

Co-authored-by: Ozkan Sezer <sezeroz@gmail.com>
2023-05-24 14:52:13 +02:00
dmitrykos 6571cbbf17 Fixed compile error under Windows if winapifamily.h is unavailable (regression of fd842b6a3b). 2023-05-23 12:05:58 +02:00
Martijn van Beurden c8e6f7372c
Prevent overflow when parsing RIFF fmt chunk 2023-05-22 21:21:33 +02:00
Martijn van Beurden 9e157b5e1e
Explain that --with-filename does not work with --export options 2023-05-22 12:02:41 +02:00
Martijn van Beurden 7761f5472c Check for FLAC__STREAM_DECODER_ABORTED on reencoding
This status was ignored, leading to an infinite loop
2023-05-20 07:29:04 +02:00
Martijn van Beurden 808efb3287 Explicitly check for bps == 0 when applying replaygain
During application of replaygain, bps is checked to be > 0. This
should never happen in a valid file. This check is specific for
replaygain application instead of more generic (at streaminfo)
because we still want to be able to recover files in which
streaminfo is invalid or missing.
2023-05-20 07:29:04 +02:00
Martijn van Beurden 69155423c4 Check for replaygain peak value being positive on parsing 2023-05-20 07:29:04 +02:00
Martijn van Beurden 890912644a Add seed corpus files for fuzzer_tool_flac 2023-05-20 07:29:04 +02:00
Martijn van Beurden ef34ee5269 Small correction on commit 7ed6f4f
The 4 byte application id was not considered

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=59015
2023-05-17 21:44:32 +02:00
Martijn van Beurden f18692df18 Add OOM check to metaflac append handling
Credit: Oss-Fuzz
Issue: N/A
2023-05-17 21:44:32 +02:00
Martijn van Beurden 7ed6f4ff58 Throw error on too large foreign metadata directly
Previously, too large chunks of foreign metadata (> 16MiB) were
signalled by libFLAC, throwing an error upon adding the metadata,
so flac gave a rather vague error back to the user. This commit
adds detection to the foreign metadata handling, so the user gets
a much clearer error.

Credit: Oss-Fuzz
Issue: N/A
2023-05-11 17:20:30 +02:00
Martijn van Beurden c65ef58924 Stop processing subframes when invalid data is found
This fixes https://github.com/xiph/flac/issues/580

The problem was that after encountering a problem in a first
subframe, the state was changed from READ_FRAME to
SEARCH_FOR_FRAME_SYNC, which meant a problem in the second
subframe was interpreted as a read error instead of invalid data.

With this patch, processing of subframes is stopped after setting
SEARCH_FOR_FRAME_SYNC
2023-05-11 09:01:44 +02:00
Martijn van Beurden c623f0f42c Fix use-after-free warning in GCC 12
A pointer was used for arithmatic after a realloc.

Co-authored-by: Alexia Massalin <alexia@lambda.csail.mit.edu>
2023-05-09 20:29:05 +02:00
DK fd842b6a3b
Fixed compilation of get_utf8_argv() for Windows UWP
Fixed compilation in Win32 environment.
Use FLAC_WINDOWS_APP define to check between UWP app and Win32 for more consistency.
2023-05-09 14:37:57 +02:00
Martijn van Beurden 22fffdceb8 Check for overflow when multiplying skip samples with sample size
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58606
2023-05-08 19:39:08 +02:00
Martijn van Beurden afad04f0a9 Fix undefined shift
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58602
2023-05-08 19:39:08 +02:00
Martijn van Beurden ebc2a69697 Fix mistake in eba4b6f and add check to seektable_is_legal
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58546
2023-05-08 19:39:08 +02:00
Martijn van Beurden 183b22ac32 When outputting partial frame, emulate verbatim frame
After seeking, a partial frame is passed to the write callback.
The FLAC__Frame passed there only has its blocksize and sample
number changed to accomodate. This results in several 'rules'
being violated. For example, the predictor order can be larger
than the blocksize. This caused integer underflow in the analysis
output of the flac command line program, causing heap overflow.
Also, the output analysis data is junk, because the residual and
rice parameters are not changed accordingly, as this would
violate other things that are otherwise given, like the number
of rice partitions being a power of 2.

To remedy this, a FLAC__Frame is now output stating that all
subframes are of the verbatim type, which has no restrictions
like fixed and lpc subframes have.

A better remedy will have to wait to the next API change, to
introduce a few new subframe types for this case and the case
of conveying an unreadable frame.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58481
2023-05-08 19:39:08 +02:00
Martijn van Beurden 4caaef6bf4
Fix compilation of getopt1.c on Intel Compiler with LLVM backend
This mirrors a change in 2005 to the GCC getopt1.c.
2023-05-05 09:20:19 +02:00
Martijn van Beurden 1b92b86ac9 Check for samplerate != 0 before dividing by it
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58199
2023-05-04 20:48:36 +02:00
Martijn van Beurden 365c7aa92e Add another check for overflow in cuesheet parsing code
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58406
2023-05-04 20:48:36 +02:00