Bug 173458 - The createOffer method don't generates a blob of SDP wthitout the addStream method(Safari 11.0).
Summary: The createOffer method don't generates a blob of SDP wthitout the addStream m...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari Technology Preview
Hardware: PC macOS 10.13
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-06-15 23:18 PDT by lwu
Modified: 2017-09-19 20:40 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lwu 2017-06-15 23:18:27 PDT
Summary:
Highlights of Safari 11.0
Web conferencing: Implements peer to peer conferencing with the WebRTC standard.

So, I test it in the 11.0(13604.1.21.7) version.
I creates an RTCPeerConnection object, and don't call the addStream method. 
Then, I call the createOffer method, and it doesn't generates a blob of SDP.


Steps to Reproduce:
Step 1 :
        var pc1 = new RTCPeerConnection();

Step 2 :
        var offerOptions = {
               offerToReceiveAudio: false,
               offerToReceiveVideo: true
         };
         
        pc1.onicecandidate = function(e) {
                 if (event.candidate) {
                        pc1.addIceCandidate(new RTCIceCandidate(event.candidate)
                        ).then(
                          function() {
                                   console.log('pc1 addIceCandidate success');
                          },
                          function(err) {
                                    console.log('pc1 failed to add ICE Candidate: ' + error.toString() );
                           }
                         );
                         console.log('pc1 ICE candidate: \n' + event.candidate.candidate);
                 }
         };

         pc1.createOffer(
                         offerOptions
         ).then(
                onCreateOfferSuccess,
               onCreateSessionDescriptionError
         );

Step 3 :
        function onCreateOfferSuccess(desc) {
                console.log('Offer from pc1\n' + desc.sdp);
                 ...  //omit following method
        }
        function onCreateSessionDescriptionError(desc) {
                console.log('pc1 Failed to create session description: ' + error.toString());
                 ...  //omit following method
        }


In step 3, onCreateOfferSuccess function prints: 

Offer from pc1
v=0
o=- 1206206593124710074 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS

This is all it prints. 

On the other hand:

In step 2, if I call the addStream method, like this.

var localstream = undefined;
navigator.mediaDevices.getUserMedia({
         audio: false,
         video: {
                   width: 1920,
                   height: 1080
          }
} )
.then(gotStream)
 .catch(function(e) {
    alert('getUserMedia() error: ' + e.name);
  });   

function gotStream(stream) {
  console.log('Have local stream');
  localStream = stream;
}

pc1.addStream(localStream);
pc1.createOffer(
    offerOptions
  ).then(
    onCreateOfferSuccess,
    onCreateSessionDescriptionError
  );

In step 3, onCreateOfferSuccess function prints Properly.


Expected Results:
I use the same steps in Chrome and Firefox.

In step 3( Chrome), onCreateOfferSuccess function prints:

Offer from pc1
v=0
o=- 5144877199436949312 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE video
a=msid-semantic: WMS
m=video 9 UDP/TLS/RTP/SAVPF 96 98 100 102 127 97 99 101 125
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:CLXs
a=ice-pwd:/HxM44PpI+OcG0OWaaUy6dUM
a=fingerprint:sha-256 8D:CD:D8:21:17:7B:CA:EC:5A:92:71:6C:89:F0:E7:0E:D6:CA:43:1A:1D:C5:15:E7:3A:82:A9:CE:8C:A7:28:9C
a=setup:actpass
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 urn:3gpp:video-orientation
a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtpmap:100 H264/90000
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:102 red/90000
a=rtpmap:127 ulpfec/90000
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:125 rtx/90000
a=fmtp:125 apt=102


 
It Contains the codec/RTP/RTCP capabilities supported by this implementation, and parameters of the ICE agent and the DTLS connection. and doesn't include descriptions of the local MediaStreamTracks.
Then, the onicecandidate callback will be triggered. I can establish a peer to peer conferencing with the WebRTC standard.
There is the same resu in Firefox. 


I wish Safari  has the same behavior, like Chrome and Firefox.

Observed Results:
The createOffer method  don't generates a blob of SDP wthitout the addStream method .
When I want to recv stream and don't send stream, I can't establish a peer to peer conferencing.

Version:
Version: Safari 11.0(13604.1.21.7)
Comment 1 Radar WebKit Bug Importer 2017-06-16 00:26:44 PDT
<rdar://problem/32809646>
Comment 2 youenn fablet 2017-06-20 16:16:57 PDT
WebKit is not supporting  offerToReceiveAudio: false and offerToReceiveVideo: true.
Instead, one can use addTransceiver instead.
Can you try that and see whether that works for you with the latest SafariTechPreview?
Comment 3 lwu 2017-06-24 00:16:01 PDT
(In reply to youenn fablet from comment #2)
> WebKit is not supporting  offerToReceiveAudio: false and
> offerToReceiveVideo: true.
> Instead, one can use addTransceiver instead.
> Can you try that and see whether that works for you with the latest
> SafariTechPreview?


Thanks for your reply, I tyr it.


Steps to Reproduce:
Step 1 :
        var pc1 = new RTCPeerConnection();

Step 2 :
        pc1.onicecandidate = function(e) {
                 if (event.candidate) {
                        pc1.addIceCandidate(new RTCIceCandidate(event.candidate)
                        ).then(
                          function() {
                                   console.log('pc1 addIceCandidate success');
                          },
                          function(err) {
                                    console.log('pc1 failed to add ICE Candidate: ' + error.toString() );
                           }
                         );
                         console.log('pc1 ICE candidate: \n' + event.candidate.candidate);
                 }
         };

         pc1.addTransceiver("video");

         pc1.createOffer().then(
                onCreateOfferSuccess,
               onCreateSessionDescriptionError
         );

Step 3 :
        function onCreateOfferSuccess(desc) {
                console.log('Offer from pc1\n' + desc.sdp);
                 ...  //omit following method
        }
        function onCreateSessionDescriptionError(desc) {
                console.log('pc1 Failed to create session description: ' + error.toString());
                 ...  //omit following method
        }


In step 3, onCreateOfferSuccess function prints: 

Offer from pc1
v=0
o=- 1206206593124710074 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS



It doesn't seem to work as well when I do it. 
So, I viewed the source code of Webkit.
I found that the Webkit does not provide the js API.

File path:   webkit/Source/ThirdParty/libwebrtc/Source/webrtc/api/peerconnectioninterface.h

Line: 550

Notes:

// Creates a sender without a track. Can be used for "early media"/"warmup"
  // use cases, where the application may want to negotiate video attributes
  // before a track is available to send.
  //
  // The standard way to do this would be through "addTransceiver", but we
  // don't support that API yet.
  //
  // |kind| must be "audio" or "video".
  //
  // |stream_id| is used to populate the msid attribute; if empty, one will
  // be generated automatically.
Comment 4 youenn fablet 2017-06-24 08:46:49 PDT
http://trac.webkit.org/browser/trunk/LayoutTests/webrtc/video-addTransceiver.html is passing on latest WebKit and should probably cover your case.

Maybe support of this feature is not yet in STP.
You might want to try WebKit Nightly or wait for next STP.
Comment 5 youenn fablet 2017-07-10 13:24:55 PDT
lwu, can you retry with STP34?
If it works, can I close the bug?
Comment 6 lwu 2017-09-19 20:40:06 PDT
(In reply to youenn fablet from comment #5)
> lwu, can you retry with STP34?
> If it works, can I close the bug?

I'm sorry for the late reply, it works;

Thanks.