Chromium Code Reviews| Index: Source/modules/mediastream/RTCPeerConnection.cpp |
| diff --git a/Source/modules/mediastream/RTCPeerConnection.cpp b/Source/modules/mediastream/RTCPeerConnection.cpp |
| index 51a5d99241a3b761e296aeab803183121f94da90..54d847684b922b40a6e12e7ddca4190ed554134b 100644 |
| --- a/Source/modules/mediastream/RTCPeerConnection.cpp |
| +++ b/Source/modules/mediastream/RTCPeerConnection.cpp |
| @@ -275,6 +275,8 @@ RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, RTCConfiguration |
| exceptionState.throwDOMException(NotSupportedError, "Failed to initialize native PeerConnection."); |
| return; |
| } |
| + m_localDescription = RTCSessionDescription::create(m_peerHandler->localDescription()); |
| + m_remoteDescription = RTCSessionDescription::create(m_peerHandler->remoteDescription()); |
| } |
| RTCPeerConnection::~RTCPeerConnection() |
| @@ -335,15 +337,21 @@ void RTCPeerConnection::setLocalDescription(RTCSessionDescription* sessionDescri |
| RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), this, successCallback, errorCallback); |
| m_peerHandler->setLocalDescription(request, sessionDescription->webSessionDescription()); |
| + m_localDescription = sessionDescription; |
| } |
| -RTCSessionDescription* RTCPeerConnection::localDescription(ExceptionState& exceptionState) |
| +RTCSessionDescription* RTCPeerConnection::localDescription() |
| { |
| + if (!m_peerHandler) |
| + return nullptr; |
| WebRTCSessionDescription webSessionDescription = m_peerHandler->localDescription(); |
| if (webSessionDescription.isNull()) |
| return nullptr; |
| - return RTCSessionDescription::create(webSessionDescription); |
| + if (!m_localDescription || m_localDescription->webSessionDescription() != webSessionDescription) { |
| + m_localDescription = RTCSessionDescription::create(webSessionDescription); |
| + } |
| + return m_localDescription; |
| } |
| void RTCPeerConnection::setRemoteDescription(RTCSessionDescription* sessionDescription, VoidCallback* successCallback, RTCErrorCallback* errorCallback, ExceptionState& exceptionState) |
| @@ -358,15 +366,21 @@ void RTCPeerConnection::setRemoteDescription(RTCSessionDescription* sessionDescr |
| RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), this, successCallback, errorCallback); |
| m_peerHandler->setRemoteDescription(request, sessionDescription->webSessionDescription()); |
| + m_remoteDescription = sessionDescription; |
|
Jens Widell
2015/05/04 06:44:23
I'm unsure exactly how things work here, but I sus
changbin
2015/05/04 10:12:23
Agree and thanks:)
Current implemention will give
Jens Widell
2015/05/04 10:20:50
Now you no longer keep the object passed to setRem
|
| } |
| -RTCSessionDescription* RTCPeerConnection::remoteDescription(ExceptionState& exceptionState) |
| +RTCSessionDescription* RTCPeerConnection::remoteDescription() |
| { |
| + if (!m_peerHandler) |
| + return nullptr; |
| WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescription(); |
| if (webSessionDescription.isNull()) |
| return nullptr; |
| - return RTCSessionDescription::create(webSessionDescription); |
| + if (!m_remoteDescription || m_remoteDescription->webSessionDescription() != webSessionDescription) { |
| + m_remoteDescription = RTCSessionDescription::create(webSessionDescription); |
| + } |
| + return m_remoteDescription; |
| } |
| void RTCPeerConnection::updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState& exceptionState) |
| @@ -824,6 +838,8 @@ DEFINE_TRACE(RTCPeerConnection) |
| visitor->trace(m_localStreams); |
| visitor->trace(m_remoteStreams); |
| visitor->trace(m_dataChannels); |
| + visitor->trace(m_localDescription); |
| + visitor->trace(m_remoteDescription); |
| #if ENABLE(OILPAN) |
| visitor->trace(m_scheduledEvents); |
| #endif |