Some remotes don't respond as expected to the test. Retune will give connection
refused, because the test is made too quickly, before the service is running.
Even if we delay the test it won't work because Retune crashes.
Since the false mdns advertisements are only seen on Airplay, we only do the
test there.
The unconfigurable resync period of 10 seconds was not frequent
enough to keep my own ALSA device in sync with the AirPlay stream.
Now the period is configurable. The default is still at 10
seconds, to prevent any change in behavior unless opted in by
the user.
Currently the adjustment causes a tiny "click" distortion in the
ALSA output, so it is better to make the check as infrequent as
possible, while still being frequent enough to stay in sync
over lengthy sessions of playback.
Added source_sample_rate, target_sample_rate to alsa_session.
This is a first step toward rendering ALSA at a different
sampling rate than the AirPlay stream, so that (a) we will
be able to dynamically adjust the ALSA sampling rate for an
improved sync algorithm, and (b) later, a more generalized
resampling algorithm can accommodate very different hardware
sampling rates like 22050 Hz or 48000 Hz.
Reworked alsa_session_free() so that it can be used to
tear down a partially initialized alsa_session if an
error occurs in the middle of alsa_session_make().
This simplifies the error handling logic in alsa_session_make().
This refactoring will be helpful later when resampling is added,
because more data structures will be dynamically allocated
during initialization.
Signed-off-by: Don Cross <cosinekitty@gmail.com>
The current logic in httpd_dacp.c cannot handle non persistent items
correctly. The items are always shown with the dummy_mfi with "unkown
artist" etc.
Ommits useless update query for playcount for items that are not in the
library. Also avoids trying to scrobble these items (fixes error log
message "lastfm: Scrobble failed, track id 9999999 is unknown")
The connection test would not catch "No route to host", as this is returned
through the value-result buffer.
This fix might partially solve issue #498.
AirPlay 2 devices like Sonos One and AirPort Express with firmware 7.8
require auth-setup before ANNOUNCE, otherwise they will return 403.
Also fixed a problem where metadata did not get sent when toggling
a speaker on/off if we were playing an endless stream.
Avoid calling cache_daap_add() when hreq->user_agent is NULL
(user agent is not provided by the client), because it will
trigger a segfault when strdup() is called with that NULL pointer.
Fixes#571.