1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Encode several images concurrently — the *safe* way.
//!
//! The bundled SVT-AV1 keeps a global state that is set per-encode, so running concurrent encodes with **different**
//! configurations in one process corrupts that state and segfaults. Concurrent encodes that all use the **same**
//! configuration (here: defaults) are safe and were verified stable under load.
//!
//! If you need different settings across threads, serialize the encoding behind a lock instead (see the README
//! "Troubleshooting" section).
//!
//! Run with:
//!
//! ```text
//! cargo run --example parallel_encode
//! ```
use Error;
use thread;
const SOURCE: &str = concat!;