pulseaudio/src/modules/rtp/rtsp-util.h
Mohamed Akram 31b6ecd507 raop: fix auth, reconnect, apple tv compat
The digest was not used in subsequent requests resulting in a 401 from
ANNOUNCE. This was changed so that the Authorization header is present
on all requests.

Reconnection did not handle the case where pa_rtsp_connect returned
immediately with a failure. This error was also not checked by
pa_raop_client_authenticate and pa_raop_client_announce, which caused
the raop client to be permanently stuck on failure as it assumed the
connection was ongoing. Similarly, a failure in SETUP was also not
reported and caused the client to be stuck. These issues were fixed and
conflicting disconnects/reconnects that caused crashes due to race
conditions were removed. We also avoid unloading the module due to a
failure since it might be recoverable. If a device is not accessible
anymore, the discover module will remove it.

Apple TV requires that the timing port is open and responding before
a SETUP response is provided, otherwise a 500 error is returned after
some time. This was added and the connection callback is called earlier
so that the sink loop can respond to timing requests in this phase. A
keep-alive request was also added as it is required by Apple TV to
prevent the stream from stopping.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/820>
2024-06-22 01:41:40 +04:00

41 lines
1.4 KiB
C

#ifndef foortsputilfoo
#define foortsputilfoo
/***
This file is part of PulseAudio.
Copyright 2008 Colin Guthrie
Copyright Kungliga Tekniska högskolan
Copyright 2013 Martin Blanchard
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
***/
/***
This file was originally inspired by a file developed by
Kungliga Tekniska högskolan.
***/
int pa_rtsp_base64_encode(const void *data, int len, char **str);
int pa_rtsp_base64_decode(const char *str, void *data);
int pa_rtsp_md5_hash(const char *data, int len, char **str);
int pa_rtsp_basic_response(const char *user, const char *pwd, char **str);
int pa_rtsp_digest_response(const char *user, const char *realm, const char *password,
const char *nonce, const char *method, const char *uri, char **str);
void pa_rtsp_rtrim_char(char *str, char rc);
#endif