Base A/V synchronization on sync_labels.

Groups of streams that should be synchronized are signalled through
SDP. These should be used rather than synchronizing the first-added
video stream to the first-added audio stream implicitly.

BUG=webrtc:4667
R=hta@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org
TBR=mflodman@webrtc.org

Review URL: https://codereview.webrtc.org/1181653002

Cr-Commit-Position: refs/heads/master@{#9586}
diff --git a/webrtc/video_engine/vie_sync_module.cc b/webrtc/video_engine/vie_sync_module.cc
index c5a7744..9c0aab3 100644
--- a/webrtc/video_engine/vie_sync_module.cc
+++ b/webrtc/video_engine/vie_sync_module.cc
@@ -67,6 +67,13 @@
                                  RtpRtcp* video_rtcp_module,
                                  RtpReceiver* video_receiver) {
   CriticalSectionScoped cs(data_cs_.get());
+  // Prevent expensive no-ops.
+  if (voe_channel_id_ == voe_channel_id &&
+      voe_sync_interface_ == voe_sync_interface &&
+      video_receiver_ == video_receiver &&
+      video_rtp_rtcp_ == video_rtcp_module) {
+    return 0;
+  }
   voe_channel_id_ = voe_channel_id;
   voe_sync_interface_ = voe_sync_interface;
   video_receiver_ = video_receiver;