Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Unified Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 2631433002: Rename RTCPeerConnection.updateIce to setConfiguration and make it work. (Closed)
Patch Set: Rebase. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..65e9e940169a2f2c439b45942f1574d62187f945 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.
+ NOTREACHED() << "webrtc::RTCErrorType " << webrtc_error.type()
+ << " not covered by switch statement.";
+ break;
+ }
+}
+
void RunClosureWithTrace(const base::Closure& closure,
const char* trace_event_name) {
TRACE_EVENT0("webrtc", trace_event_name);
@@ -1393,7 +1434,7 @@ RTCPeerConnectionHandler::remoteDescription() {
return CreateWebKitSessionDescription(sdp, type);
}
-bool RTCPeerConnectionHandler::setConfiguration(
+blink::WebRTCErrorType RTCPeerConnectionHandler::setConfiguration(
const blink::WebRTCConfiguration& blink_config) {
DCHECK(thread_checker_.CalledOnValidThread());
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setConfiguration");
@@ -1402,7 +1443,15 @@ bool RTCPeerConnectionHandler::setConfiguration(
if (peer_connection_tracker_)
peer_connection_tracker_->TrackSetConfiguration(this, configuration_);
- return native_peer_connection_->SetConfiguration(configuration_);
+ webrtc::RTCError webrtc_error;
+ blink::WebRTCError blink_error;
+ bool ret =
+ native_peer_connection_->SetConfiguration(configuration_, &webrtc_error);
+ // The boolean return value is made redundant by the error output param; just
+ // DCHECK that they're consistent.
+ DCHECK_EQ(ret, webrtc_error.type() == webrtc::RTCErrorType::NONE);
+ ConvertToWebKitRTCError(webrtc_error, &blink_error);
+ return blink_error.type();
}
bool RTCPeerConnectionHandler::addICECandidate(
« no previous file with comments | « content/renderer/media/rtc_peer_connection_handler.h ('k') | content/renderer/media/rtc_peer_connection_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698