Commit Graph

381 Commits

Author SHA1 Message Date
ejurgensen
d2d9b78ae7 [player] Don't unselect disappeared speakers on exit/restart
With the new speaker selection philosophy we aim to preserve user choice, so we
shouldn't unselect speakers just because they happen to be switched off when
the server is restarted.
2020-10-19 20:36:32 +02:00
ejurgensen
81c776fc4a [player] Fixup commit 1f45967 2020-09-21 17:18:09 +02:00
ejurgensen
1f45967481 [player] Fix autoselect so it also applies when there are no selected devices (second attempt)
Second attempt at fixing regression in version 27.2. First attempt was commit 2345885.

Closes #1091.
2020-09-21 17:12:18 +02:00
ejurgensen
513a09e6d1 [player] Reduce log severity of devices not starting 2020-09-06 23:18:08 +02:00
ejurgensen
2345885f19 [player] Fix autoselect so it also applies when there are no selected devices
Regression in version 27.2. Closes #1091.
2020-09-06 00:12:15 +02:00
ejurgensen
a5ddb3c85d [player] Fix for volumes of unselected devices being reduced
Closes #1077
2020-08-13 20:48:48 +02:00
ejurgensen
55d5289c05 [player] Add settings for persisting repeat, shuffle and consume
Closes issue #963
2020-07-24 20:15:03 +02:00
ejurgensen
a71444d3e1 [player] Limit auto reconnection + add option for user override
With this commit auto reconnection per default will only be done for ATV4s and
HomePods. Reconnection is not always desirable, for instance if the device cuts
the connection because it is busy with something else, ref. issue #934.

The commit also adds an option to override auto reconnection, thus either
enabling it for other devices or disabling it for affected devices.
2020-07-24 00:10:26 +02:00
ejurgensen
941fb47c1d [player] Only resurrect speakers that fail during playback
Fix bug where we would resurrect speakers, incl restart playback, if the speaker
disconnected after a flush.

Closes #1057
2020-07-16 23:08:58 +02:00
Christian Meffert
0e8e8564bb
Merge pull request #1042 from chme/player-prev-next
[player/jsonapi] Do not report error on skip next/prev if end/start of queue is reached
2020-07-05 10:58:50 +02:00
ejurgensen
a2ec7ee28f [outputs] Fix gcc 10 complaining about multiple definitions
outputs_master_volume, output_device_list and output_buffer were defined in
outputs.h, but should only have been declared with extern.

Solve it by making output_buffer static/non-global (wasn't used anyway), and
the two others are now returned by functions.
2020-06-29 00:19:03 +02:00
chme
8e333c7978 [player/jsonapi] Do not report error on skip next/prev if end/start of
queue is reached
2020-06-28 11:56:51 +02:00
ejurgensen
5d22f11b0e [player/outputs] Fix for speaker selection and volume adj (closes #1011)
* Make sure that vol_adjust() bases adjustments on the same speakers that the
  user sees as active
* If a speaker fails during activation we unselect it, so that we don't keep
  trying to start it, so we find a new master volume if required, and so it is
  possible for the user to reselect it.
2020-05-27 23:02:29 +02:00
ejurgensen
3cca778419 [player] Stop using outputs_authorize() so it can be removed
Use outputs_device_authorize() instead
2020-05-26 23:20:29 +02:00
ejurgensen
18e75c2445 [player] Add player_speaker_authorize()
A more straightforward function for device verification, using the new
outputs_device_authorize() function.
2020-05-26 22:45:38 +02:00
ejurgensen
010185eab5 [player] Another way of implementing commit 3b033e48 2020-05-25 22:43:04 +02:00
ejurgensen
3b033e48ee [player] Consolidate listener handling in one player trigger - wip
The goal is to make the listener invokation more unified and less ad hoc. Also
reduce risk of blocking/deadlocking player thread.
2020-05-25 22:42:22 +02:00
ejurgensen
e570cbdcbd [player] Use input progress metadata to update clients
Before, we were ignoring progress metadata, and we were also updating clients
and db too early with input metadata (right when read from the input, instead of
waiting until playback (speakers) were at that position.

This change adds a complicated async chain of events from when the update is
received.
2020-05-12 20:16:15 +02:00
ejurgensen
661289990c [player] Migrate a lot of speaker handling to outputs.c
Moves speaker selection, volume handling and startup to outputs.c, plus adds
the ability to "resurrect" a speaker that disconnects.

The purpose of moving the code is to concentrate device handling in one place.

Also changes how we deal with speaker selection. The player will now generally
not alter a user selection, even if the device fails. The purpose of this is to
maintain selection both if the device briefly fails, and if the user switches
off the device (we stop playback) and later turns it on + starts new playback.
2020-05-03 00:00:18 +02:00
ejurgensen
d3fb451960 [player] Save seek position more often
Makes it possible for the user to resume playback from the correct position if
for instance the speaker disconnects -> pb_abort is called.
2020-04-27 21:29:51 +02:00
ejurgensen
b78282db38 [player] Only send startup metadata once 2020-04-24 18:46:17 +02:00
ejurgensen
4491928466 [player] Don't send metadata before the input has started
Otherwise we have a race condition between the worker and the input thread. If
the worker returns with metadata before the input thread has started reading,
then pb_session.pts will still be zero, which means metadata->pts will be zero
in finalize_cb(). That is an invalid time to give the outputs.
2020-04-24 18:46:17 +02:00
ejurgensen
08b2eb8d4c [dacp/player] Change support for prevent-playback and busy (ref issue #934)
Adds support for dcmp.device-busy, and also changes handling of
device-prevent-playback so it matches iTunes better.
2020-04-10 21:01:41 +02:00
ejurgensen
e61e98bcbb [player] Reverse args to player_speaker_get_byid() for consistency 2020-01-03 19:38:52 +01:00
ejurgensen
af1bc27dd5 [dacp] Support for dmcp.device-prevent-playback (issue #855) 2020-01-03 19:36:35 +01:00
ejurgensen
33f97f55f3 [player] Fix for #860, going to next track when consume is enabled 2019-12-17 20:58:47 +01:00
chme
4c835f4435 [player] Remove dead code and rework check if fetching queue item failed 2019-10-20 14:36:21 +02:00
chme
69d3c97b7e [player] Fix freeing of queue item if error happens during seek
Plus fix some code style issues and add more documentation
2019-10-20 14:36:21 +02:00
chme
6e5d6791ff [player/dacp/mpd/jsonapi] Combine seek commands into one with mode param
Also changes relative seeking behavior:
- seeking behind the the current track only switches to the previous
track, if we are not more than 3 seconds into the current track,
otherwise starts current track from the beginning
- seeking beyond the current track will start the next track from the
beginning
2019-10-20 14:36:21 +02:00
chme
ced11ef0c1 [player] Allow seeking by a relative amount of milliseconds 2019-10-20 14:36:21 +02:00
chme
e3edcb5b96 [player] Fix missing update of master volume in web interface
Activating/deactivating an output might change the master volume,
therefor send a volume change notification.
2019-09-26 08:11:29 +02:00
ejurgensen
e1a0e366cf [dacp] Make sure Remote updates images from metadata pipes 2019-09-20 21:47:17 +02:00
ejurgensen
4ab734343c [-] Free events on exit (turns out event_base_free does not free them)
Credit @whatdoineed2do, ref. pr #797
2019-09-09 22:23:00 +02:00
ejurgensen
9cb5810e9a [player] Avoid repeated resets on output delay when changing track (issue #781) 2019-08-18 23:12:10 +02:00
ejurgensen
b9b2874a2e [player] Possible fix for issue #781 where playback status is incorrect
pb_suspend() + pb_resume() during track changes made the playback status
incorrect, i.e. pb_session.source_list/playing_now would not match what the
input was actually writing. This attempts to solve it by resetting the
session when pb_suspend() is called, so that the input, input_buffer and
source_list come into sync.
2019-08-17 01:44:45 +02:00
ejurgensen
5307c6d94b [player] Fix commit 3e9f8ef, input_resume() must be non-blocking (possibly issue #773) 2019-07-14 00:02:50 +02:00
ejurgensen
3e9f8effa0 [player] Better fix for resuming playback af long pause (issue #766)
The fix in commit 3928ab6 broke resuming from an underrun, since it meant that
pb_resume() would flush the input buffer. With this fix it is possible to call
input_resume(), which will not flush the buffer if the source is already open.

Also renamed some functions in player.c for consistency.
2019-07-12 19:11:48 +02:00
ejurgensen
3928ab6f82 [player] Fix for resuming playback after long pause (issue #766)
After a long pause the input would close the source (due to INPUT_OPEN_TIMEOUT).

This change makes the player restart the input when resuming.
2019-07-09 23:12:20 +02:00
ejurgensen
a208604c86 [player] More comprehensive attempt at fixing short tracks (issue #733)
Replace reading_next and reading_prev with a list of sources, so that we can
deal with short tracks, i.e. tracks where reading ends before playback starts.
2019-05-11 23:16:22 +02:00
ejurgensen
f793ad9f3e [player] Fix incorrect player state while buffering (partial fix for #738)
Player would return PLAYER_PLAYING when resuming playback after a pause, but
it should initially return PLAYER_PAUSED because it is still buffering.
2019-05-10 16:47:18 +02:00
ejurgensen
1948dcb959 [player] Quick fix for short track segfault (issue #733)
With short tracks reading ends before playback starts, so event_read_eof comes
before event_play_start, which causes playing_now to point to a null
reading_now.

With this change it will point to a non-null reading_prev, but note that in the
hopefully rare case of multiple short tracks, the playing_now pointer will
still be incorrect.
2019-05-05 23:21:28 +02:00
ejurgensen
ce2be1a724 [-] A bit of cleaning up 2019-04-10 22:38:48 +02:00
ejurgensen
9836280029 [player] Fix issue where sync timestamps are incorrect after pb_suspend() 2019-03-28 23:06:45 +01:00
ejurgensen
f1493db069 [player] Fix bug where device is always deselected before db_speaker_save() 2019-03-28 10:47:58 +01:00
ejurgensen
5f84fefd1b [player] Remove pause timer remnants (moved to input/output in prev commit) 2019-03-27 22:48:09 +01:00
ejurgensen
d10e8ab1a2 [player] Fix proceed to next if track cannot be opened 2019-03-27 22:29:28 +01:00
ejurgensen
4a664cfa9f [player] Fix playback start not showing in some clients 2019-03-24 22:53:01 +01:00
ejurgensen
1b0892a53a [player] Fix player losing quality + invalid return values from source_read() 2019-03-23 23:10:23 +01:00
ejurgensen
aa36353480 [player] Fixup crash if playback stops while sending metadata 2019-03-22 23:24:11 +01:00
ejurgensen
4fb45e84f2 [player/outputs] New metadata handling (wip) 2019-03-18 23:06:08 +01:00