Chromium Code Reviews| Index: content/renderer/media/rtc_peer_connection_handler.cc |
| diff --git a/content/renderer/media/rtc_peer_connection_handler.cc b/content/renderer/media/rtc_peer_connection_handler.cc |
| index 8fda6f1c307bfcde4cf828943f11b5a73b9815ac..da866d91b8bbe1b9f434fea389368c4e97d7eb8f 100644 |
| --- a/content/renderer/media/rtc_peer_connection_handler.cc |
| +++ b/content/renderer/media/rtc_peer_connection_handler.cc |
| @@ -40,6 +40,7 @@ |
| #include "third_party/WebKit/public/platform/WebRTCAnswerOptions.h" |
| #include "third_party/WebKit/public/platform/WebRTCConfiguration.h" |
| #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" |
| +#include "third_party/WebKit/public/platform/WebRTCError.h" |
| #include "third_party/WebKit/public/platform/WebRTCICECandidate.h" |
| #include "third_party/WebKit/public/platform/WebRTCLegacyStats.h" |
| #include "third_party/WebKit/public/platform/WebRTCOfferOptions.h" |
| @@ -160,6 +161,46 @@ CreateWebKitSessionDescription( |
| return CreateWebKitSessionDescription(sdp, native_desc->type()); |
| } |
| +void ConvertToWebKitRTCError(const webrtc::RTCError& webrtc_error, |
| + blink::WebRTCError* blink_error) { |
| + switch (webrtc_error.type()) { |
| + case webrtc::RTCErrorType::NONE: |
| + blink_error->setType(blink::WebRTCErrorType::kNone); |
| + break; |
| + case webrtc::RTCErrorType::UNSUPPORTED_PARAMETER: |
| + blink_error->setType(blink::WebRTCErrorType::kUnsupportedParameter); |
| + break; |
| + case webrtc::RTCErrorType::INVALID_PARAMETER: |
| + blink_error->setType(blink::WebRTCErrorType::kInvalidParameter); |
| + break; |
| + case webrtc::RTCErrorType::INVALID_RANGE: |
| + blink_error->setType(blink::WebRTCErrorType::kInvalidRange); |
| + break; |
| + case webrtc::RTCErrorType::SYNTAX_ERROR: |
| + blink_error->setType(blink::WebRTCErrorType::kSyntaxError); |
| + break; |
| + case webrtc::RTCErrorType::INVALID_STATE: |
| + blink_error->setType(blink::WebRTCErrorType::kInvalidState); |
| + break; |
| + case webrtc::RTCErrorType::INVALID_MODIFICATION: |
| + blink_error->setType(blink::WebRTCErrorType::kInvalidModification); |
| + break; |
| + case webrtc::RTCErrorType::NETWORK_ERROR: |
| + blink_error->setType(blink::WebRTCErrorType::kNetworkError); |
| + break; |
| + case webrtc::RTCErrorType::INTERNAL_ERROR: |
| + blink_error->setType(blink::WebRTCErrorType::kInternalError); |
| + break; |
| + default: |
| + // If adding a new error type, need 3 CLs: One to add the enum to webrtc, |
| + // one to update this mapping code, and one to start using the enum in |
| + // webrtc. |
| + DCHECK(false) << "webrtc::RTCErrorType " << webrtc_error.type() << |
|
perkj_chrome
2017/01/13 09:14:06
NOTREACHED()
|
| + " not covered by switch statement."; |
| + break; |
| + } |
| +} |
| + |
| void RunClosureWithTrace(const base::Closure& closure, |
| const char* trace_event_name) { |
| TRACE_EVENT0("webrtc", trace_event_name); |
| @@ -1394,7 +1435,8 @@ RTCPeerConnectionHandler::remoteDescription() { |
| } |
| bool RTCPeerConnectionHandler::setConfiguration( |
| - const blink::WebRTCConfiguration& blink_config) { |
| + const blink::WebRTCConfiguration& blink_config, |
| + blink::WebRTCError& error) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setConfiguration"); |
| GetNativeRtcConfiguration(blink_config, &configuration_); |
| @@ -1402,7 +1444,11 @@ bool RTCPeerConnectionHandler::setConfiguration( |
| if (peer_connection_tracker_) |
| peer_connection_tracker_->TrackSetConfiguration(this, configuration_); |
| - return native_peer_connection_->SetConfiguration(configuration_); |
| + webrtc::RTCError webrtc_error; |
| + bool ret = |
| + native_peer_connection_->SetConfiguration(configuration_, &webrtc_error); |
| + ConvertToWebKitRTCError(webrtc_error, &error); |
| + return ret; |
| } |
| bool RTCPeerConnectionHandler::addICECandidate( |