<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>215422</bug_id>
          
          <creation_ts>2020-08-12 12:26:42 -0700</creation_ts>
          <short_desc>Safari 13.1.2 onicecandidate event is raised before iceGatheringState transitions to &quot;gathering&quot; state</short_desc>
          <delta_ts>2020-08-19 12:27:16 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebRTC</component>
          <version>Safari 13</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>macOS 10.14</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Charlie">csantos</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>csantos</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1679791</commentid>
    <comment_count>0</comment_count>
    <who name="Charlie">csantos</who>
    <bug_when>2020-08-12 12:26:42 -0700</bug_when>
    <thetext>During the ICE gathering phase, RTCPeerConnection.onicecandidate event is raised before RTCPeerConnection.iceGatheringState transitions to &quot;gathering&quot;. This only happens on Safari 13.1.2. Prior versions of Safari and other browser works as expected.

Here&apos;s what&apos;s happening on Safari 13.1.2
1. ICE Gathering starts
2. A local ICE Candidate is gathered
3. RTCPeerConnection.onicecandidate event is raised
4. RTCPeerConnection.iceGatheringState changes to &quot;gathering&quot;
5. RTCPeerConnection.iceGatheringState changes to &quot;complete&quot;

The issue is on steps 3 and 4. The expected should be
1. ICE Gathering starts
2. A local ICE Candidate is gathered
3. RTCPeerConnection.iceGatheringState changes to &quot;gathering&quot;
4. RTCPeerConnection.onicecandidate event is raised
5. RTCPeerConnection.iceGatheringState changes to &quot;complete&quot;

Steps to reproduce:
The issue is rarely reproducible if you setup 2 peer connections on a single machine, but it still happens. But we can consistently reproduce when we are connected to our media server. Try loading this page https://networktest.twilio.com, and wait for the &quot;Voice: Test call using PCMU&quot; section to execute. The test will fail because onicecandidate was triggering before iceGatheringState changes to &quot;gathering&quot;.

I can provide pcaps and/or SDPs if they are needed. Please let me know if you need more information.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1681442</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-08-19 12:27:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/67418966&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>