Commit Graph

4474 Commits

Author SHA1 Message Date
Martijn van Beurden 0dd1140a71
Add libtool to MacOS dependencies for github actions (#695) 2024-05-01 08:55:23 +02:00
Martijn van Beurden 61f8513c1f
Fix bug in CHECK_ORDER_IS_VALID macro (#694)
Fixes https://github.com/xiph/flac/issues/635
2024-04-30 15:30:30 +02:00
Steve Lhomme 49ab34dfef [CMake] disable fseeko on 32-bit Android before API 24
It can be linked in the NDK so check_function_exists detects it. But it's only supporting _FILE_OFFSET_BITS=64
since Android API 24 [1].

With NDK 26 it's no longer possible to build assuming the API is always available.

[1] https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md
2024-04-22 14:37:41 +02:00
Steve Lhomme 9977bb5b77 include/share/compat.h : use fseek if fseeko is not available 2024-04-22 14:37:41 +02:00
Martijn van Beurden 5f6a352921
Update github action dependencies to latest versions (#682)
As described here:
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
2024-03-28 08:04:21 +01:00
Martijn van Beurden 67a65b7ccf
Improve failure handling when multithreading (#681)
In case of encoder failure within a thread, asserts were false
and a locked mutex would be destroyed. This fix leaves in a race
condition: encoder->protected_->state is written without a lock.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62650
2024-03-27 21:51:07 +01:00
Martijn van Beurden d2b2441056
Different loose mid side algorithm compatible with multithreading (#675) 2024-03-09 21:40:03 +01:00
werner mendizabal 8d4ccdfbb1
Update CMakeLists to allow building with emscripten (#664) 2024-03-08 19:03:11 +01:00
Martijn van Beurden 8a685ee77c Silence fuzzer_seek 2024-03-07 21:02:05 +01:00
Martijn van Beurden 9504c76970 Handle missing decoder in FLAC__stream_encoder_get_verify_decoder_state() 2024-03-07 21:02:05 +01:00
Miroslav Lichvar 377289eea9 Handle missing decoder in FLAC__stream_encoder_get_resolved_state_string()
Fix crash when trying to get the decoder's state string while the decoder
is missing due to a memory allocation error.
2024-03-07 21:02:05 +01:00
Martijn van Beurden 79a164ecdf Augment fuzzing to catch https://github.com/xiph/flac/pull/645 2024-03-07 21:02:05 +01:00
Martijn van Beurden 37ca81137a
Refind import cuesheet op after appending seekpoints (#677)
This fixes a heap-use-after-free. The free was part of a realloc,
and the cuesheet op handle was still pointing to the old
allocation

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61292
2024-03-06 16:56:09 +01:00
Sam James e7d336c7a2
flac: foreign_metadata: fix -Walloc-size (#654)
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
src/flac/foreign_metadata.c:803:33: warning: allocation of insufficient size ‘1’ for type ‘foreign_metadata_t’ with size ‘64’ [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(foreign_metadata_t)`. GCC then sees we're not
doing anything wrong.

Signed-off-by: Sam James <sam@gentoo.org>
2024-03-06 12:54:37 +01:00
Martijn van Beurden 89a4d2b9fc
Fix format ending up with wrong subformat (#676)
It was possible the format was taken from foreign metadata and the
subformat from command-line options.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63790
2024-03-05 17:58:17 +01:00
Cristian Rodríguez 0c8afdf35a
fix invalid C23 in process_frame_thread_ (#649)
process_frame_thread_ should return NULL instead of false,
in C23 NULL and _Bool are not compatible and the code is rightfully
rejected by the compiler.

"stream_encoder.c:3595:48: error: incompatible types when returning type
‘_Bool’ but ‘void *’ was expected"
2024-03-05 13:18:25 +01:00
Martijn van Beurden 4194eb677e Let libFLAC send an error when frames are missing 2024-03-03 21:45:17 +01:00
Martijn van Beurden ab99a4b56b Add check that sample/frame number increases correctly 2024-03-03 21:45:17 +01:00
Martijn van Beurden 66152791d8
Let `flac -t` parse all metadata blocks (#626) 2024-03-01 08:50:35 +01:00
Martijn van Beurden 7f7da558f5 Remove checks for semaphore.h in CMake and configure 2024-02-26 21:54:37 +01:00
Martijn van Beurden 82c23ba31a Add more explanation to threading code 2024-02-26 21:54:37 +01:00
Martijn van Beurden 1cea6bb5be Switch from semaphores to mutexes, remove extra debug checks 2024-02-26 21:54:37 +01:00
Martijn van Beurden 9e93c4526b Add extra debug checks for threading 2024-02-26 21:54:37 +01:00
Martijn van Beurden eb59fbe89e Add explanation as to how threading works 2024-02-26 21:54:37 +01:00
Martijn van Beurden 72787c3fee
Add documentation on foreign metadata storage format 2023-11-24 13:45:21 +01:00
Martijn van Beurden 8cf7e7fbb5 Update API version numbers and ABI dumps 2023-09-22 21:10:15 +02:00
Martijn van Beurden 0118be95f9 [CI] Also upload compat reports on failure 2023-09-22 21:10:15 +02:00
Martijn van Beurden c227be6c12 Add multithreading to libFLAC++ and more fuzzers 2023-09-22 21:10:15 +02:00
Martijn van Beurden 8c41e7f62e Add multithreading to CMake 2023-09-22 21:10:15 +02:00
Martijn van Beurden d2f0a1a812 Add multithreading to API documentation and man page 2023-09-22 21:10:15 +02:00
Martijn van Beurden e0ebc8eb7e Limit max number of threads in case of fuzzing
Fuzzing with memory sanitizer gave out-of-memory failures
2023-09-22 21:10:15 +02:00
Martijn van Beurden c1f0eb4bea Raise max number of threads, improve thread testing 2023-09-22 21:10:15 +02:00
Martijn van Beurden 790b759072 Simplify mutex scheme and fix some bugs 2023-09-22 21:10:15 +02:00
Martijn van Beurden 021e82bfcc Add checks for 'overcommitting'
This scales the number of active threads back when threads have to
wait for work too often
2023-09-22 21:10:15 +02:00
Martijn van Beurden bcc37540aa Fix threads busy waiting for MD5 2023-09-22 21:10:15 +02:00
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