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

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

Issue 2631433002: Rename RTCPeerConnection.updateIce to setConfiguration and make it work. (Closed)
Patch Set: Simplifying signature of WebRTCPeerConnectionHandler::setConfiguration. 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..55622fb3c5cb966a324bebb09a3119ebf091f053 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(ret == (webrtc_error.type() == webrtc::RTCErrorType::NONE));
dcheng 2017/01/17 09:32:03 Nit: DCHECK_EQ
Taylor_Brandstetter 2017/01/17 18:56:19 Done.
+ ConvertToWebKitRTCError(webrtc_error, &blink_error);
+ return blink_error.type();
dcheng 2017/01/17 09:32:02 I think we might not need this helper class anymor
Taylor_Brandstetter 2017/01/17 18:56:19 I expect to use it in the future, even if it didn'
dcheng 2017/01/17 23:32:59 Perhaps WebRTCVoidRequest can just use the enum ty
}
bool RTCPeerConnectionHandler::addICECandidate(

Powered by Google App Engine
This is Rietveld 408576698