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 2.2.2.2 via NAT router with address 1.1.1.1, source port is 10000, destination - 20000. On packet arrival NAT creates entry such as this:
10.0.0.2 10000 - 1.1.1.1 10000 - 2.2.2.2 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 2.2.2.2:20000 to 1.1.1.1: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.