SAP mishandling of duplicates via different addresses
We broadcast a number of IPTV channels at my organisation and want the channels available to internal and nearby external users. As a result we announce these channels via SAP on both 239.255.255.255 (SAP_V4_LOCAL_ADDRESS) and 239.195.255.255 (SAP_V4_ORG_ADDRESS)...VLC does not like this too much.
The function modules/services_discovery/sap.c::ParseSAP() has an IsSameSession() check that overlooks the possibility that the same session could arrive via different SAP listener sockets and as a result rewrites the entire SAP playlist once every 30 seconds (we announce at a period of five seconds and your 'trust' cycle of six leads to 30 seconds). Once rewritten, any channel being viewed is terminated. This repeats ever thirty seconds, getting annoying, real quickly. :)
The solution is to additionally track the SAP listener socket that the packet arrived on, and only go through the 'trust' codepath if it comes in on the same socket; ignoring duplicates (packets that match the conditions of IsSameSession) arriving via different sockets.
I have created (and attached) the trivial fix that resolves this, I am pretty sure it is a safe change to make. Nothing in RFC2974 (section 5, 'Session Modification') implies that broadcasting the same SDP payload on different SAP addresses is incorrect; hopefully I have not missed any clauses ;)