Since UDP is connection-less, NAT implementation cannot know where UDP communication actually ends, so it just creates translation table entry on first passed packet. For example, hidden host with IP 10.0.0.2 send packet to host 22.214.171.124 via NAT router with address 126.96.36.199, source port is 10000, destination - 20000. On packet arrival NAT creates entry such as this:
10.0.0.2 10000 - 188.8.131.52 10000 - 184.108.40.206 20000
Port number in second field may be different if it is already used by other translation entry. After this entry created, all UDP packets from 220.127.116.11:20000 to 18.104.22.168:10000 will be redirected to 10.0.0.2:10000.
On second question: if there is a NAT between source and destination, remote addresses reported by
getpeername(2) and reported directly by remote end (in UDP payload) will be different.
There are more info and links about NAT hole punching on wikipedia.