Implement the "needs-ice-restart" logic for SetConfiguration.

Changing the configuration will cause subsequently generated offers to change
the ufrag/pwd as necessary, so that a new round of gathering is started that
uses the new configuration.

This CL also makes some minor unrelated changes: changing the reference SDP in
the PC tests to more match what we generate, and relaxing the network thread
requirement for JsepTransport (since there's no reason the "needs-ice-restart"
flag can't be accessed from the signaling thread).

BUG=webrtc:6714

Review-Url: https://codereview.webrtc.org/2563153002
Cr-Commit-Position: refs/heads/master@{#15527}
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index e1f19ad..49f9030 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -1298,9 +1298,16 @@
     }
   }
 
-  // TODO(deadbeef): Shouldn't have to hop to the worker thread twice...
+  // TODO(deadbeef): Shouldn't have to hop to the network thread twice...
   session_->SetIceConfig(session_->ParseIceConfig(configuration));
 
+  // As described in JSEP, calling setConfiguration with new ICE servers or
+  // candidate policy must set a "needs-ice-restart" bit so that the next offer
+  // triggers an ICE restart which will pick up the changes.
+  if (configuration.servers != configuration_.servers ||
+      configuration.type != configuration_.type) {
+    session_->SetNeedsIceRestartFlag();
+  }
   configuration_ = configuration;
   return true;
 }