Commit graph

1692 commits

Author SHA1 Message Date
Roderick van Domburg a605444d18
Merge pull request #926 from JasonLG1979/clippy-lints-portaudio
Fix clippy lint warning
2022-01-06 09:49:18 +01:00
Roderick van Domburg c1965198fc
Move DeviceType to core 2022-01-06 09:48:11 +01:00
Roderick van Domburg 4ca1f661d5
Prevent deadlock 2022-01-06 09:43:50 +01:00
Philip Deljanov 5d44f910f3 Handle format reset and decode errors.
This change fixes two issues with the error handling of the
Symphonia decode loop.

1) `Error::ResetRequired` should always be propagated to jump
    to the next Spotify track.

2) On a decode error, get a new packet and try again instead of
   propagating the error and jumping to the next track.
2022-01-05 18:17:33 -05:00
JasonLG1979 cfde70f6f9 Fix clippy lint warning 2022-01-05 16:55:16 -06:00
Roderick van Domburg cc9a574b2e
Move ConnectConfig to connect 2022-01-05 21:15:19 +01:00
Roderick van Domburg 1a7c440bd7
Improve lock ordering and contention 2022-01-05 20:44:08 +01:00
Roderick van Domburg 5c2b5a21c1
Fix audio file caching 2022-01-05 16:43:46 +01:00
Roderick van Domburg 3e09eff906
Improve initial loading time
- Configure the decoder according to Spotify's metadata, don't probe

- Return from `AudioFile::open` as soon as possible, with the smallest
  possible block size suitable for opening the decoder, so the UI
  transitions from loading to playing/paused state. From there,
  the regular prefetching will take over.
2022-01-04 23:23:20 +01:00
Roderick van Domburg eabdd79275
Seeking, buffer size and error handing improvements
- Set ideal sample buffer size after decoding first full packet
- Prevent audio glitches after seeking
- Reset decoder when the format reader requires it

Credits: @pdeljanov
2022-01-04 21:23:53 +01:00
Roderick van Domburg a49bcb70a7
Fix clippy lints 2022-01-04 21:22:52 +01:00
Roderick van Domburg 8dbcda6bc2
Merge branch 'dev' into new-api 2022-01-04 01:13:48 +01:00
Roderick van Domburg d5a4be4aa1
Optimize fallback sample buffer size 2022-01-04 00:50:45 +01:00
Roderick van Domburg 01448ccbe8
Seek in milliseconds and report the actual new position 2022-01-04 00:17:30 +01:00
Roderick van Domburg f3a66d4b99
Remove lewton decoder 2022-01-03 22:41:54 +01:00
Roderick van Domburg 92b8476645
Merge pull request #922 from JasonLG1979/cleanup_list_compatible_devices
Clean up `list_compatible_devices`
2022-01-03 22:32:22 +01:00
Roderick van Domburg 096269c1d0
Reintroduce offset for passthrough decoder 2022-01-03 22:20:29 +01:00
Roderick van Domburg 84e3fe5558
Bump MSRV to 1.53 2022-01-03 01:01:29 +01:00
Roderick van Domburg 60d78b6b58
Bump MSRV to 1.51 2022-01-03 00:44:41 +01:00
Roderick van Domburg 7921f23927
Improve format handling and support MP3
- Switch from `lewton` to `Symphonia`. This is a pure Rust demuxer
  and decoder in active development that supports a wide range of
  formats, including Ogg Vorbis, MP3, AAC and FLAC for future HiFi
  support. At the moment only Ogg Vorbis and MP3 are enabled; all
  AAC files are DRM-protected.

- Bump MSRV to 1.51, required for `Symphonia`.

- Filter out all files whose format is not specified.

- Not all episodes seem to be encrypted. If we can't get an audio
  key, try and see if we can play the file without decryption.

- After seeking, report the actual position instead of the target.

- Remove the 0xa7 bytes offset from `Subfile`, `Symphonia` does
  not balk at Spotify's custom Ogg packet before it. This also
  simplifies handling of formats other than Ogg Vorbis.

- When there is no next track to load, signal the UI that the
  player has stopped. Before, the player would get stuck in an
  infinite reloading loop when there was only one track in the
  queue and that track could not be loaded.
2022-01-03 00:13:28 +01:00
JasonLG1979 8dfa00d66f Clean up list_compatible_devices
Fix a typo and be a little more forgiving.
2022-01-01 17:19:12 -06:00
Roderick van Domburg 2d699e288a
Follow autoplay client setting 2022-01-01 20:23:21 +01:00
Roderick van Domburg 9202ec01d4
Merge pull request #920 from gdesmott/write-own
Sink: pass ownership of the packet on write()
2022-01-01 17:00:03 +01:00
Guillaume Desmottes f09be4850e Sink: pass ownership of the packet on write()
Prevent a copy if the implementation needs to keep the data around.
2021-12-31 13:46:35 +01:00
Roderick van Domburg 0fdff0d3fd
Follow client setting to filter explicit tracks
- Don't load explicit tracks when the client setting forbids them

 - When a client switches explicit filtering on *while* playing
   an explicit track, immediately skip to the next track
2021-12-30 23:50:28 +01:00
Roderick van Domburg 2af34fc674
Add product metrics to requests 2021-12-30 22:36:38 +01:00
Roderick van Domburg 286a031d94
Always seek to starting position 2021-12-30 21:52:15 +01:00
Roderick van Domburg 05c768f612
Add audio preview, image and head file support 2021-12-30 21:35:43 +01:00
Roderick van Domburg 9b6e02fa0d
Prevent a few potential panics 2021-12-29 23:15:08 +01:00
Roderick van Domburg e51f475a00
Further initial loading improvements
This should fix remaining cases of a client connecting, and failing
to start playback from *beyond* the beginning when `librespot` is
still loading that track.

This undoes the `suppress_loading_status` workaround from #430,
under the assumption that the race condition reported there has
since been fixed on Spotify's end.
2021-12-29 22:27:31 +01:00
Roderick van Domburg e5938c7e24
Merge pull request #919 from gdesmott/race-fix
player: ensure `load_track` threads are done when dropping `PlayerInternal`
2021-12-29 20:40:30 +01:00
Guillaume Desmottes 3ce9854df5 player: ensure load threads are done when dropping PlayerInternal
Fix a race where the load operation was trying to use a disposed tokio
context, resulting in panic.
2021-12-29 16:00:45 +01:00
Roderick van Domburg afa2a021db
Enable CI for new-api 2021-12-29 08:38:08 +01:00
Roderick van Domburg 29b42ef62d
Merge branch 'dev' into new-api 2021-12-29 08:23:50 +01:00
Roderick van Domburg b4d3c8363f
Merge pull request #891 from roderickvd/new-api-wip
WIP: new Spotify API
2021-12-29 07:42:57 +01:00
Roderick van Domburg 332f9f04b1
Fix error hitting play when loading
Further changes:

 - Improve some debug and trace messages

 - Default to streaming download strategy

 - Synchronize mixer volume on loading play

 - Use default normalisation values when the file position isn't
   exactly what we need it to be

 - Update track position only when the decoder reports a
   successful seek
2021-12-28 23:46:37 +01:00
Roderick van Domburg 0f78fc277e
Call stream_from_cdn with CdnUrl 2021-12-27 21:42:57 +01:00
Roderick van Domburg 4646ff3075
Re-order actions and fail on clippy lints 2021-12-27 20:52:15 +01:00
Roderick van Domburg b1bdf1d7f2
Merge pull request #916 from JasonLG1979/remove-last-unwraps-from-main
Remove `unwrap`s from main
2021-12-27 11:36:03 +01:00
Roderick van Domburg 01fb604420
Allow failures on nightly Rust 2021-12-27 09:47:51 +01:00
Roderick van Domburg b7c047bca2
Fix alternative tracks 2021-12-27 09:35:11 +01:00
Roderick van Domburg 643b39b40e
Fix discovery compilation with-dns-sd 2021-12-27 00:47:17 +01:00
Roderick van Domburg b622e3811e
Enable HTTP/2 flow control 2021-12-27 00:45:27 +01:00
JasonLG1979 1f43e9e389 Remove that last couple unwraps from main
Also:

* Don't just hang if Spirc shuts down too often.

* Replace the while loop with Vec retain.

* Be more explicit with the rate limit.
2021-12-26 17:45:06 -06:00
Roderick van Domburg 95776de74a
Fix compilation for with-dns-sd 2021-12-27 00:21:42 +01:00
Roderick van Domburg 8aa23ed0c6
Drop locks as soon as possible 2021-12-27 00:11:07 +01:00
Roderick van Domburg 059e17dca5
Fix tests 2021-12-26 23:51:25 +01:00
Roderick van Domburg b4f7a9e35e
Change to parking_lot and remove remaining panics 2021-12-26 23:02:02 +01:00
Roderick van Domburg 62461be1fc
Change panics into Result<_, librespot_core::Error> 2021-12-26 21:18:42 +01:00
Roderick van Domburg 4370aa1cbe
Merge pull request #910 from JasonLG1979/fix-alsa-mixer-device
Fix auto fallback for --alsa-mixer-device and --alsa-mixer-index
2021-12-22 08:47:27 +01:00