Commit graph

1867 commits

Author SHA1 Message Date
JasonLG1979
25425dab5c Put CommonSampleRates to some use and clean up backend imports 2023-06-30 12:36:12 -05:00
JasonLG1979
242e68a98c Revert remaining spirc changes
It's best to deal with this after discovery is fixed.
2023-06-30 10:56:44 -05:00
Jason Gray
b15b48b626 Merge branch 'dev' into resampling 2023-06-30 10:30:26 -05:00
Jason Gray
4d6de15a97
Discovery retry (#1178)
When started at boot as a service discovery may fail due to it
trying to bind to interfaces before the network is actually up.
This could be prevented in systemd by starting the service after
network-online.target but it requires that a wait-online.service is
also enabled which is not always the case since a wait-online.service
can potentially hang the boot process until it times out in certain situations.
This allows for discovery to retry every 10 secs in the 1st 60 secs of uptime
before giving up thus papering over the issue and not holding up the boot process.
2023-06-30 09:30:14 +02:00
Jason Gray
00ee65b006
Merge branch 'librespot-org:dev' into resampling 2023-06-29 20:31:46 -05:00
JasonLG1979
15e2b441aa Fully implement CommonSampleRates 2023-06-29 16:35:54 -05:00
JasonLG1979
1ab5bac786 Address review comments 2023-06-28 22:16:33 -05:00
Roderick van Domburg
e5d364b07a
Merge pull request #1181 from yubiuser/xml
Update quick-xml to 0.29
2023-06-28 22:18:26 +02:00
Roderick van Domburg
2242a24d7e
Merge pull request #1175 from librespot-org/dependabot/github_actions/dev/actions/checkout-3.5.3
Bump actions/checkout from 3.5.2 to 3.5.3
2023-06-28 22:03:29 +02:00
JasonLG1979
cea92a9c3a Avoid unnecessary Vec -> Slice -> Vec
In the case of a resampler bypass
2023-06-27 19:21:02 -05:00
JasonLG1979
20414e44b8 More warnings 2023-06-27 17:05:52 -05:00
JasonLG1979
841f923549 Remove unnecessary step
Our interpolation_coefficients are already normalized.
2023-06-27 16:13:31 -05:00
JasonLG1979
d1e4b4464a Break message recursion. 2023-06-26 21:31:03 -05:00
JasonLG1979
4b081b1365 Warn that trying to resample 44.1kHz to 44.1kHz is a stupid thing to do. 2023-06-26 18:00:39 -05:00
JasonLG1979
c29ec3f473 Add warning about Normalisation Attack or Release being to small 2023-06-26 17:45:28 -05:00
JasonLG1979
2fa2bf86cb Don't handle messages that are not intended for us in spirc.
This prevents 2 active instances of librespot from effectively arguing over who the current active instance actually is. Without it events recurse.
2023-06-26 17:12:32 -05:00
JasonLG1979
98f1fe84dd Reduce allocations 2023-06-26 05:11:30 -05:00
JasonLG1979
8e6d452765 Don't use Instant elapsed
It would be so much easier to use elapsed but elapsed could potentially panic is rare cases.

See:

https://doc.rust-lang.org/std/time/struct.Instant.html#monotonicity
2023-06-26 02:32:39 -05:00
JasonLG1979
d3ae1cdc55 Update all deps 2023-06-25 21:09:43 -05:00
Christian König
9c30532fd4
Update quick-xml to 0.29
Signed-off-by: Christian König <ckoenig@posteo.de>
2023-06-25 23:32:09 +02:00
JasonLG1979
528a8a431e Don't pad the alsa buffer anymore on stop.
It's no longer necessary with the SymphoniaDecoder, in fact it causes the problem it used to prevent. Namely pops when you pause.
2023-06-24 22:50:32 -05:00
JasonLG1979
ac2c05a0f8 Reset the resampler's latency when stopped 2023-06-24 20:16:21 -05:00
JasonLG1979
f7c56dff44 Remove AudioPacketPosition
We don't need it since we now tell if we've skipped packets by calculating a max delta.
2023-06-24 18:59:01 -05:00
JasonLG1979
5e02b6643d Simplify time calculations in SymphoniaDecoder
Time impl's from f64 (as secs) so there's no need to manually calculate it beyond converting ms to sec.

If we grab the TimeBase in new we don't need to continually call decoder.codec_params().time_base everytime we want to convert ts to ms.
2023-06-24 18:10:35 -05:00
JasonLG1979
0bdfa726ca Remove round from pulse get_latency_pcm, floor math is fine 2023-06-24 15:26:29 -05:00
JasonLG1979
74b52e83fa Improve resampler performance
Do less calls into the worker.
2023-06-24 15:06:28 -05:00
JasonLG1979
ad4763005d Add release-dist-optimized profile
release-dist-optimized inherits from `release`. Useful if you're distributing librespot at part of a project. The diffrences are:

panic = "abort", Makes librespot abort instead of unwind and hang on a panic.
Extremely useful when running librespot unattended as a system service for example to allow for auto-restarts.

codegen-units = 1 and lto = true, Take slighly longer to compile but produce more optimized binaries.
2023-06-23 18:51:17 -05:00
JasonLG1979
340bac5eb0 Warn the user if the try to set interpolation-quality with 44.1kHz 2023-06-23 14:33:01 -05:00
JasonLG1979
46b8f84d6a Make sure there is only ever one allocation when converting
Collect is probably fine but for code that's this hot it's worth the couple extra lines to make certain there's only ever one allocation when it comes to the returned Vec.
2023-06-23 12:00:42 -05:00
JasonLG1979
5da8ddf5e2 Rename set_factor to update_normalisation_data to better indicate what it does 2023-06-23 11:24:10 -05:00
JasonLG1979
bfb0366c90 Make sure the ResampleWorker task_receiver is also drained on drop 2023-06-23 10:10:14 -05:00
JasonLG1979
0e3ffe5394 Harmonize thread names and debug messages 2023-06-23 03:08:22 -05:00
JasonLG1979
8d35b4b860 Update notify_about_position logic
It would be so much easier to use elapsed but elapsed could potentially panic is rare cases.

See: https://doc.rust-lang.org/std/time/struct.Instant.html#monotonicity

Otherwise this is pretty straight forward.
If anything fails getting expected_position_ms it will return 0 which will trigger a notify if either stream_position_ms or decoder_position_ms is > 1000.

If all goes well it's simply a matter of calculating the max delta of expected_position_ms and stream_position_ms and expected_position_ms and decoder_position_ms.
So if the decoder or the sample pipeline are off by more than 1 sec we notify.
2023-06-23 00:38:15 -05:00
JasonLG1979
09bd1bd324 Fix up notify 2023-06-22 04:43:56 -05:00
JasonLG1979
b5e0ea2bd3 Fix examples and update change log 2023-06-22 02:06:24 -05:00
JasonLG1979
586e9f1929 Fix clippy lint round 1000 + a small bug fix 2023-06-22 01:40:50 -05:00
JasonLG1979
2a8da828c4 Fix clippy lint 2023-06-22 01:26:15 -05:00
JasonLG1979
efec96b9cc Put it all together 2023-06-21 23:32:03 -05:00
JasonLG1979
e1ea400220 Change the backends so that they support the diffrent sample rates 2023-06-21 22:17:41 -05:00
JasonLG1979
3bcf5498d2 Convert get_latency_pcm to get_latency_ms in sample_pipeline 2023-06-21 21:11:37 -05:00
JasonLG1979
9861a582a6 Add sample_pipeline 2023-06-21 20:55:00 -05:00
JasonLG1979
375f83797a Add normaliser 2023-06-21 20:48:02 -05:00
JasonLG1979
3b64f25286 Add resampler 2023-06-21 20:29:22 -05:00
JasonLG1979
71660a2351 Add InterpolationQuality and SampleRate enums 2023-06-21 19:51:14 -05:00
JasonLG1979
7dae33c4f0 Use default macro 2023-06-21 19:24:40 -05:00
JasonLG1979
35b94bdc94 Add the ability to get backend latency 2023-06-21 19:17:23 -05:00
JasonLG1979
0cefd0ea66 Better thread handling in player 2023-06-21 19:09:21 -05:00
dependabot[bot]
1ac9818a00
Bump actions/checkout from 3.5.2 to 3.5.3
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3.5.2...v3.5.3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-10 11:02:28 +00:00
eladyn
4d402e690c
add session timeout handling (#1129) 2023-06-01 21:39:35 +02:00
Roderick van Domburg
310725d2fb
Merge pull request #1150 from yubiuser/tweak/workflow_order
Check formatting and linting first on workflow
2023-06-01 20:51:29 +02:00