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..99b1b7a05c07354f99d2d01aac18898c7919df6a 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,42 @@ 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: |
perkj_chrome
2017/01/12 08:56:19
nit: remove default to make sure this has to be up
Taylor_Brandstetter
2017/01/13 19:14:19
Done.
|
+ blink_error->setType(blink::WebRTCErrorType::kInternalError); |
+ break; |
+ } |
+} |
+ |
void RunClosureWithTrace(const base::Closure& closure, |
const char* trace_event_name) { |
TRACE_EVENT0("webrtc", trace_event_name); |
@@ -1394,7 +1431,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 +1440,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( |