edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! Audio output checks. These need a PulseAudio-protocol server (pipewire-pulse |
| 2 | //! or PulseAudio), so they are `#[ignore]`d by default. They only ever talk to |
| 3 | //! the server named by `PULSE_SERVER`, and refuse to run against the default |
| 4 | //! one under `$XDG_RUNTIME_DIR`: point them at a private instance. Run them with: |
| 5 | //! |
| 6 | //! ```text |
| 7 | //! PULSE_SERVER=unix:/path/to/private/pulse/native \ |
| 8 | //! cargo test -p engine --release --test ao_output -- --ignored --nocapture --test-threads=1 |
| 9 | //! ``` |
| 10 | //! |
| 11 | //! `no_daemon_opens_nothing` re-runs itself as a child process with |
| 12 | //! `PULSE_SERVER` pointed at a missing socket, since the client reads the real |
| 13 | //! environment. |
| 14 | |
| 15 | use TAU; |
| 16 | use ; |
| 17 | |
| 18 | use AoSession; |
| 19 | |
| 20 | const RATE: u32 = 44100; |
| 21 | const CHANNELS: u32 = 2; |
| 22 | |
| 23 | /// Half a second of a quiet 1 kHz tone, interleaved stereo. |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | /// Opens the device the way this suite wants it: connected for real, and |
| 35 | /// silent. Everything these tests assert -- that the clock runs, at the right |
| 36 | /// rate, and stops when the stream is paused -- is measured from the device's |
| 37 | /// own position, which the gain does not touch: the frames are still consumed, |
| 38 | /// only the last multiply before the speaker is zero. |
| 39 | /// |
| 40 | /// corner-cut: it does mean the suite is deaf, so a gain stuck at zero would pass |
| 41 | /// it. Nothing here could ever hear that -- the checks that can are the gain unit |
| 42 | /// test in `pulse` and a person with the app open. The upgrade path is recording |
| 43 | /// a null sink and asserting on the samples that come back. |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | /// Routes the opens in this suite to the real server, and only to a server the |
| 52 | /// caller named: a suite that fell through to the default socket would play |
| 53 | /// through the person's own sound. A session's own server lives under |
| 54 | /// `/run/user/<uid>`, so that prefix is refused. |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | /// Waits up to `limit` for the clock to report a played position past zero. |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | /// Muting is not pausing: the device keeps consuming and the master clock keeps |
| 125 | /// running, which is the whole reason the picture can play on through a mute. |
| 126 | /// That the samples really go quiet is the gain unit test in `pulse` -- nothing |
| 127 | /// out here can hear the device. |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | /// No reachable daemon must fail the open cleanly and quickly, never hang. |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 |