WebRTC - ICE candidate raciness
The ICE gathering state can change to complete before all the ICE candidates are output, if libnice has upnp disabled, with a sequence like:
- app sets the remote description
- _create_transport_channel() queues an update_ice_gathering_state_task() that will run later
- webrtcbin calls gst_webrtc_ice_gather_candidates() which calls nice_agent_gather_candidates()
- nice_agent_gather_candidates() synchronously emits ICE candidates (normally async if gupnp is available) and they are queued for emission from the webrtcbin main loop
- GstWebRTCICEStream gets the candidate-gathering-done signal which queues an update_ice_gathering_state_task()
- The first update_ice_gathering_state_task() runs, and concludes that the ICE gathering state is complete, even though there are queued candidates.
This MR fixes that, and also a potential crash using the existing remote ICE candidates array by protecting it with a new mutex.