Bug 195930 - createAnswer() SDP Rejected by setLocalDescription()
Summary: createAnswer() SDP Rejected by setLocalDescription()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 12
Hardware: Mac macOS 10.13
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-03-18 19:20 PDT by Vincent Olivier
Modified: 2019-05-28 16:14 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.23 KB, patch)
2019-05-28 10:00 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Olivier 2019-03-18 19:20:08 PDT
Safari 12.1 beta 5 on macOS 10.13. Kurento 6.9.0 (MCU).

This is a one-way Safari to Kurento stream recording system. We are recording the image from a canvas and the user audio. Kurento makes the offer and Safari creates an answer. It works perfectly fine in Safari 12. But in Safari 12.1, the pc.setLocalDescription promise fails like so :

pc.setRemoteDescription(new RTCSessionDescription({sdp: kurentoSdpOffer, type : "offer"}))
.then(() => pc.createAnswer())
.then(safariSdpAnswer => {
  return pc.setLocalDescription(safariSdpAnswer); // <-- This promise fails.
},
errorMessage => {
  console.error(errorMessage);
});

kurentoSdpOffer :
v=0
o=- 3761869441 3761869441 IN IP4 0.0.0.0
s=Kurento Media Server
c=IN IP4 0.0.0.0
t=0 0
a=group:BUNDLE audio0 video0
m=audio 1 RTP/SAVPF 96
a=setup:actpass
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=rtpmap:96 opus/48000/2
a=rtcp:9 IN IP4 0.0.0.0
a=rtcp-mux
a=recvonly
a=mid:audio0
a=ssrc:424993814 cname:user947799849@host-a8497e84
a=ice-ufrag:ZLgu
a=ice-pwd:3/gb3GZYQ2wgxAHnFRT1bf
a=fingerprint:sha-256 5A:08:09:0D:E9:1C:78:20:65:64:95:6E:FE:29:91:E1:CC:6E:47:F1:A4:7A:8E:F9:6F:4D:A4:7A:7A:A2:76:BF
m=video 1 RTP/SAVPF 99
b=AS:500
a=setup:actpass
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=rtpmap:99 H264/90000
a=rtcp:9 IN IP4 0.0.0.0
a=rtcp-mux
a=recvonly
a=mid:video0
a=rtcp-fb:99 nack
a=rtcp-fb:99 nack pli
a=rtcp-fb:99 ccm fir
a=ssrc:3599710107 cname:user947799849@host-a8497e84
a=ice-ufrag:ZLgu
a=ice-pwd:3/gb3GZYQ2wgxAHnFRT1bf
a=fingerprint:sha-256 5A:08:09:0D:E9:1C:78:20:65:64:95:6E:FE:29:91:E1:CC:6E:47:F1:A4:7A:8E:F9:6F:4D:A4:7A:7A:A2:76:BF

safariSdpAnswer :
v=0
o=- 6264218082987584695 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio0 video0
a=msid-semantic: WMS 2911055e-5ba6-4466-b97d-5096a0cf8d54
m=audio 9 RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:i7we
a=ice-pwd:nP0vZh1MKgeVU+U1qEDEI8HL
a=ice-options:trickle
a=fingerprint:sha-256 E1:75:F9:F1:26:CD:CF:54:AE:2C:07:FB:15:BA:FC:C8:4E:06:A1:92:89:58:FB:8D:53:37:E7:40:D5:2E:39:E6
a=setup:active
a=mid:audio0
a=sendonly
a=msid:2911055e-5ba6-4466-b97d-5096a0cf8d54 2a8ab184-4d39-491b-a82e-1dc592395cb6
a=rtcp-mux
a=rtpmap:96 opus/48000/2
a=fmtp:96 minptime=10;useinbandfec=1
a=ssrc:330308847 cname:naYlH6QAtK0bdBJv
a=ssrc:330308847 msid:2911055e-5ba6-4466-b97d-5096a0cf8d54 2a8ab184-4d39-491b-a82e-1dc592395cb6
a=ssrc:330308847 mslabel:2911055e-5ba6-4466-b97d-5096a0cf8d54
a=ssrc:330308847 label:2a8ab184-4d39-491b-a82e-1dc592395cb6
m=video 9 RTP/SAVPF 0
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:i7we
a=ice-pwd:nP0vZh1MKgeVU+U1qEDEI8HL
a=ice-options:trickle
a=fingerprint:sha-256 E1:75:F9:F1:26:CD:CF:54:AE:2C:07:FB:15:BA:FC:C8:4E:06:A1:92:89:58:FB:8D:53:37:E7:40:D5:2E:39:E6
a=setup:active
a=mid:video0
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendonly
a=msid:2911055e-5ba6-4466-b97d-5096a0cf8d54 75daf2bd-16b5-4401-9b05-a9a295c37a5c
a=rtcp-mux
a=ssrc:2457216628 cname:naYlH6QAtK0bdBJv
a=ssrc:2457216628 msid:2911055e-5ba6-4466-b97d-5096a0cf8d54 75daf2bd-16b5-4401-9b05-a9a295c37a5c
a=ssrc:2457216628 mslabel:2911055e-5ba6-4466-b97d-5096a0cf8d54
a=ssrc:2457216628 label:75daf2bd-16b5-4401-9b05-a9a295c37a5c

errorMessage :
OperationError: Failed to set local answer sdp: Failed to set local video description recv parameters.

I know that you guys made the move to Unified Plan and I think that Kurento only supports plan-b. But I don't see what is wrong with the Kurento offer and the error message is not very helpful. I notice that a "rtpmap" is absent for video in the Safari answer, but I don't know what is wrong with my code. Should I be converting the SDP on the fly between Kurento and Safari ? Is this a Safari bug ?

Thanks.
Comment 1 Radar WebKit Bug Importer 2019-03-19 12:41:28 PDT
<rdar://problem/49030489>
Comment 2 youenn fablet 2019-05-20 11:39:26 PDT
Hi Vincent,

sorry for the late reply.

In your offer, there is no video codec available and the safari answer does not add any which is probably why the setLocalDescription call fails.

It is indeed not a good behavior for setLocalDescription to fail this way after a successful createAnswer call.

Would you be able to work around this and add a video codec, H264 or VP8?
Comment 3 Vincent Olivier 2019-05-23 06:06:40 PDT
Hi Youenn,

Looking at those lines from the kurentoSdpOffer :

a=rtpmap:99 H264/90000
a=rtcp:9 IN IP4 0.0.0.0
a=rtcp-mux
a=recvonly
a=mid:video0

Aren't these a video offer ?

Looking at the safariSdpAnswer, it seems more like Safari is ignoring the video offer contained in kurentoSdpOffer. If not, I don't know what to "add" to the kurentoSdpOffer to make Safari not ignore it.

Please advise.
Comment 4 youenn fablet 2019-05-23 11:44:49 PDT
(In reply to Vincent Olivier from comment #3)
> Hi Youenn,
> 
> Looking at those lines from the kurentoSdpOffer :
> 
> a=rtpmap:99 H264/90000
> a=rtcp:9 IN IP4 0.0.0.0
> a=rtcp-mux
> a=recvonly
> a=mid:video0
> 
> Aren't these a video offer ?

Oh, I haven't seen them.
To fix the issue on your side, you need to explicitly set the packetization-mode to 1.
Something like:
a=fmtp:99 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1

Agreed though that we have a bug somewhere as we should not resolve createAnswer to reject setLocalDescription.
Comment 5 youenn fablet 2019-05-23 11:45:57 PDT
I guess the easy fix might be to add both modes in the list of our supported codecs.
Comment 6 youenn fablet 2019-05-28 10:00:46 PDT
Created attachment 370752 [details]
Patch
Comment 7 WebKit Commit Bot 2019-05-28 16:14:01 PDT
Comment on attachment 370752 [details]
Patch

Clearing flags on attachment: 370752

Committed r245829: <https://trac.webkit.org/changeset/245829>
Comment 8 WebKit Commit Bot 2019-05-28 16:14:03 PDT
All reviewed patches have been landed.  Closing bug.