Preventively expect UTF8 strings from libwebrtc SDP and error messages
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2018 21:49:28 +0000 (21:49 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2018 21:49:28 +0000 (21:49 +0000)
commit3908d3eda84952885b037a36d794c0c9e0ce28e6
treeb01e40787d17960724bbc62af142634bf44bad76
parent3644108fbb32303b219d4edd2a1de3d288d0a4f0
Preventively expect UTF8 strings from libwebrtc SDP and error messages
https://bugs.webkit.org/show_bug.cgi?id=184509

Reviewed by Eric Carlson.

Source/WebCore:

Make WebCore code expect any libwebrtc string to contain UTF-8.
Currently SDPs do not contain any UTF-8 specific character
but https://tools.ietf.org/html/rfc4566 allows it.

Add Internals API to set track id so that we can inject UTF-8 inside some WebRTC tests.
Test: webrtc/utf8-sdp.html

* Modules/mediastream/MediaStreamTrack.h:
(WebCore::MediaStreamTrack::setIdForTesting):
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::fromStdString):
(WebCore::fromSessionDescription):
(WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
(WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
(WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
(WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
(WebCore::LibWebRTCMediaEndpoint::addDataChannel):
(WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
(WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
(WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
(WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
(WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
(WebCore::trackId): Deleted.
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::fromStdString):
(WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
(WebCore::createReceiverForSource):
* platform/mediastream/MediaStreamTrackPrivate.h:
(WebCore::MediaStreamTrackPrivate::setIdForTesting):
* testing/Internals.cpp:
(WebCore::Internals::setMediaStreamTrackIdentifier):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* webrtc/utf8-sdp-expected.txt: Added.
* webrtc/utf8-sdp.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/webrtc/utf8-sdp-expected.txt [new file with mode: 0644]
LayoutTests/webrtc/utf8-sdp.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp
Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl