Commit graph

28 commits

Author SHA1 Message Date
Peter Meerwald-Stadler
0f94657cd0 raop: Fix typo
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-10-09 10:39:54 +02:00
Peter Meerwald-Stadler
a39098fe4d raop: Fix gcc-7 warnings, EWOULDBLOCK
EAGAIN is used allover the code rather than EWOULDBLOCK
POSIX allows EAGAIN and EWOULDBLOCK to have the same value (and in fact it is)
don't check for EWOULDBLOCK

modules/raop/raop-client.c: In function ‘send_udp_audio_packet’:
modules/raop/raop-client.c:473:41: warning: logical ‘or’ of equal expressions [-Wlogical-op]
     if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                         ^~
modules/raop/raop-client.c: In function ‘resend_udp_audio_packets’:
modules/raop/raop-client.c:528:45: warning: logical ‘or’ of equal expressions [-Wlogical-op]
         if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                             ^~

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-10-09 10:39:52 +02:00
Peter Meerwald-Stadler
2898a5188c raop: Error out on parsing server port component
don't ignore server port parsing errors as suggested by Hajime Fujita

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Hajime Fujita <crisp.fujita@nifty.com>
2017-03-09 13:51:51 +01:00
Peter Meerwald-Stadler
add5a175b6 raop: Log if pa_atoi() fails, latency is not used anyway
Coverity ID: #1398152

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-09 13:51:51 +01:00
Peter Meerwald-Stadler
4cfd544f21 raop: Fix potential NULL dereference
wath may be NULL, as suggested by Hajime Fujita
Coverity ID: #1398156

setting val = NULL is not needed

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Hajime Fujita <crisp.fujita@nifty.com>
2017-03-09 13:51:51 +01:00
Peter Meerwald-Stadler
74abce331b raop: Fix check for invalid file descriptor
file descriptor 0 is valid

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-08 14:31:29 +01:00
Peter Meerwald-Stadler
0cb72beace raop: Fix potential NULL dereference
'realm' is mandatory

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-07 09:47:46 +01:00
Peter Meerwald-Stadler
6c35ac7c8f raop: Silence unchecked return value warnings
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-07 09:47:46 +01:00
Peter Meerwald-Stadler
20960e7cc6 raop: Fix indentation
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-07 09:47:46 +01:00
Peter Meerwald-Stadler
4d7922d091 raop: Fix resource leaks
Coverity ID: #1398158, #1398159

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-07 09:47:46 +01:00
Peter Meerwald-Stadler
4bb25292f8 raop: Fix memleak
use local scope for trs variable simplifying cleanup
Coverity ID: #1398160

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-07 09:47:46 +01:00
Peter Meerwald-Stadler
95d850a5ad raop: Fail after search for port number
should also fail if port is 0 after the loop, as suggested by Georg Chini

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-07 09:47:46 +01:00
Peter Meerwald-Stadler
df9cda67d2 raop: Fix loop searching for port number
do...while not reachable, loop should try different ports in case EADDRINUSE is returned
Coverity ID: #1398161

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
2017-03-06 08:22:33 +01:00
ced2c
b365d7e60c raop: Fix #37: OOB access in rtsp_auth_cb
Allocation for Apple-Challenge key is now defined to 16 bytes
(instead of 16 bits)

This patch fixes Issue #37
https://github.com/hfujita/pulseaudio-raop2/issues/37
2017-01-19 03:10:19 +02:00
Hajime Fujita
ab7b7ee249 raop: Fix memory leaks
This patch fixes several memory leaks, and thereby fixes Issue #35.
(https://github.com/hfujita/pulseaudio-raop2/issues/35)
2017-01-19 03:10:19 +02:00
Hajime Fujita
d7721032ea raop: Discard data upon getting EAGAIN on a socket
This patch discards audio data when a socket returns EAGAIN.
This was made based on a suggestion by karlstav
(https://github.com/karlstav), and is supposed to solve Issue #32.
(https://github.com/hfujita/pulseaudio-raop2/issues/32)
2017-01-19 03:10:19 +02:00
Hajime Fujita
3e26f2d15e raop: Disable is_recording flag when tearing down the connection
This patch is based on a similar idea as the previous one -- disabling
the flag right after the session is getting closed, rather than waiting
for a response from the server.
2017-01-19 03:10:19 +02:00
Hajime Fujita
f3aa588a61 raop: Stop recording when RTSP FLUSH is issued
This patch fixes the issue #31.
https://github.com/hfujita/pulseaudio-raop2/issues/31

This patch sets c->is_recording = false when the RTSP FLUSH command
is issued. This avoids a race between the server response and
the record activation in some cases.
2017-01-19 03:10:19 +02:00
Martin Blanchard
516906aef9 raop: Correctly wrap RTP packet sequence number 2017-01-19 03:10:19 +02:00
Hajime Fujita
3de65e61e4 raop: Add IPv6 support 2017-01-19 03:10:19 +02:00
Stephen Paul Weber
751d88717e raop: Do not flush when RTSP object is not ready
This patch fixes a crash issue reported at
https://github.com/hfujita/pulseaudio-raop2/issues/9
2017-01-19 03:10:19 +02:00
Colin Leroy
f4bd06bfa5 raop: Fix packet retransmission
Fix UDP header decoding (sequence number and number of packets);
Fix missing pa_memblock_release() causing assertions after retransmission.
2017-01-19 03:10:19 +02:00
Colin Leroy
4d16369707 raop: fix typos 2017-01-19 03:10:19 +02:00
Colin Leroy
b95aebdb2d raop: fix sequence number overflow
Wrap sequence number when we reach uint16_t's max 0xFFFF.
2017-01-19 03:10:19 +02:00
Martin Blanchard
1c56b86926 raop: Remove unimplemented code (PCM and AAC) 2017-01-19 03:10:19 +02:00
Martin Blanchard
750a677b43 raop: Rework packet's store memory management
This patch switch the packet-buffer to use core memory pool instead of
manually allocating the room required for storing TCP/UDP packets. Packets
are now stored using pa_memchunk instead of internal struct. Quite a few
malloc saved compare to previous design.
2017-01-19 03:10:19 +02:00
Martin Blanchard
32a5b3047b raop: Update and standardise source file headers 2017-01-19 03:10:19 +02:00
Martin Blanchard
8022e56581 raop: Merge TCP and UDP code paths + refactoring
TCP and UDP implementation are following two diffrent code path while code
logic is quite the same. This patch merges both code path into a unique one
and, thus, leads to a big refactoring. Major changes include:
  - moving sink implementation to a separate file (raop-sink.c)
  - move raop-sink.c protocol specific code to raop-client.c
  - modernise RTSP session handling in TCP mode
  - reduce code duplications between TCP and UDP modes
  - introduce authentication support
  - TCP mode does not constantly send silent audio anymore

About authentication: OPTIONS is now issued when the sink is preliminary
loaded. Client authentication appends at that time and credential is kept
for the whole sink lifetime. Later RTSP connection will thus look like this:
ANNOUNCE > 200 OK > SETUP > 200 OK > RECORD > 200 OK (no more OPTIONS). This
behaviour is similar to iTunes one.

Also this patch includes file name changes to match Pulseaudio naming
rules, as most of pulseaudio source code files seem to be using '-'
instead of '_' as a word separator.
2017-01-19 03:10:19 +02:00