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

Side by Side Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 2631433002: Rename RTCPeerConnection.updateIce to setConfiguration and make it work. (Closed)
Patch Set: Fixing test code 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/rtc_peer_connection_handler.h" 5 #include "content/renderer/media/rtc_peer_connection_handler.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 22 matching lines...) Expand all
33 #include "content/renderer/media/webrtc/rtc_stats.h" 33 #include "content/renderer/media/webrtc/rtc_stats.h"
34 #include "content/renderer/media/webrtc/webrtc_media_stream_adapter.h" 34 #include "content/renderer/media/webrtc/webrtc_media_stream_adapter.h"
35 #include "content/renderer/media/webrtc_audio_device_impl.h" 35 #include "content/renderer/media/webrtc_audio_device_impl.h"
36 #include "content/renderer/media/webrtc_uma_histograms.h" 36 #include "content/renderer/media/webrtc_uma_histograms.h"
37 #include "content/renderer/render_thread_impl.h" 37 #include "content/renderer/render_thread_impl.h"
38 #include "media/base/media_switches.h" 38 #include "media/base/media_switches.h"
39 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 39 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
40 #include "third_party/WebKit/public/platform/WebRTCAnswerOptions.h" 40 #include "third_party/WebKit/public/platform/WebRTCAnswerOptions.h"
41 #include "third_party/WebKit/public/platform/WebRTCConfiguration.h" 41 #include "third_party/WebKit/public/platform/WebRTCConfiguration.h"
42 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" 42 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h"
43 #include "third_party/WebKit/public/platform/WebRTCError.h"
43 #include "third_party/WebKit/public/platform/WebRTCICECandidate.h" 44 #include "third_party/WebKit/public/platform/WebRTCICECandidate.h"
44 #include "third_party/WebKit/public/platform/WebRTCLegacyStats.h" 45 #include "third_party/WebKit/public/platform/WebRTCLegacyStats.h"
45 #include "third_party/WebKit/public/platform/WebRTCOfferOptions.h" 46 #include "third_party/WebKit/public/platform/WebRTCOfferOptions.h"
46 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" 47 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h"
47 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h" 48 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h"
48 #include "third_party/WebKit/public/platform/WebRTCVoidRequest.h" 49 #include "third_party/WebKit/public/platform/WebRTCVoidRequest.h"
49 #include "third_party/WebKit/public/platform/WebURL.h" 50 #include "third_party/WebKit/public/platform/WebURL.h"
50 #include "third_party/webrtc/pc/mediasession.h" 51 #include "third_party/webrtc/pc/mediasession.h"
51 52
52 using webrtc::DataChannelInterface; 53 using webrtc::DataChannelInterface;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 154
154 std::string sdp; 155 std::string sdp;
155 if (!native_desc->ToString(&sdp)) { 156 if (!native_desc->ToString(&sdp)) {
156 LOG(ERROR) << "Failed to get SDP string of native session description."; 157 LOG(ERROR) << "Failed to get SDP string of native session description.";
157 return blink::WebRTCSessionDescription(); 158 return blink::WebRTCSessionDescription();
158 } 159 }
159 160
160 return CreateWebKitSessionDescription(sdp, native_desc->type()); 161 return CreateWebKitSessionDescription(sdp, native_desc->type());
161 } 162 }
162 163
164 void ConvertToWebKitRTCError(const webrtc::RTCError& webrtc_error,
165 blink::WebRTCError* blink_error) {
166 switch (webrtc_error.type()) {
167 case webrtc::RTCErrorType::NONE:
168 blink_error->setType(blink::WebRTCErrorType::kNone);
169 break;
170 case webrtc::RTCErrorType::UNSUPPORTED_PARAMETER:
171 blink_error->setType(blink::WebRTCErrorType::kUnsupportedParameter);
172 break;
173 case webrtc::RTCErrorType::INVALID_PARAMETER:
174 blink_error->setType(blink::WebRTCErrorType::kInvalidParameter);
175 break;
176 case webrtc::RTCErrorType::INVALID_RANGE:
177 blink_error->setType(blink::WebRTCErrorType::kInvalidRange);
178 break;
179 case webrtc::RTCErrorType::SYNTAX_ERROR:
180 blink_error->setType(blink::WebRTCErrorType::kSyntaxError);
181 break;
182 case webrtc::RTCErrorType::INVALID_STATE:
183 blink_error->setType(blink::WebRTCErrorType::kInvalidState);
184 break;
185 case webrtc::RTCErrorType::INVALID_MODIFICATION:
186 blink_error->setType(blink::WebRTCErrorType::kInvalidModification);
187 break;
188 case webrtc::RTCErrorType::NETWORK_ERROR:
189 blink_error->setType(blink::WebRTCErrorType::kNetworkError);
190 break;
191 case webrtc::RTCErrorType::INTERNAL_ERROR:
192 blink_error->setType(blink::WebRTCErrorType::kInternalError);
193 break;
194 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.
195 blink_error->setType(blink::WebRTCErrorType::kInternalError);
196 break;
197 }
198 }
199
163 void RunClosureWithTrace(const base::Closure& closure, 200 void RunClosureWithTrace(const base::Closure& closure,
164 const char* trace_event_name) { 201 const char* trace_event_name) {
165 TRACE_EVENT0("webrtc", trace_event_name); 202 TRACE_EVENT0("webrtc", trace_event_name);
166 closure.Run(); 203 closure.Run();
167 } 204 }
168 205
169 void RunSynchronousClosure(const base::Closure& closure, 206 void RunSynchronousClosure(const base::Closure& closure,
170 const char* trace_event_name, 207 const char* trace_event_name,
171 base::WaitableEvent* event) { 208 base::WaitableEvent* event) {
172 { 209 {
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 native_peer_connection_); 1424 native_peer_connection_);
1388 RunSynchronousClosureOnSignalingThread( 1425 RunSynchronousClosureOnSignalingThread(
1389 base::Bind(&GetSdpAndTypeFromSessionDescription, description_cb, 1426 base::Bind(&GetSdpAndTypeFromSessionDescription, description_cb,
1390 base::Unretained(&sdp), base::Unretained(&type)), 1427 base::Unretained(&sdp), base::Unretained(&type)),
1391 "remoteDescription"); 1428 "remoteDescription");
1392 1429
1393 return CreateWebKitSessionDescription(sdp, type); 1430 return CreateWebKitSessionDescription(sdp, type);
1394 } 1431 }
1395 1432
1396 bool RTCPeerConnectionHandler::setConfiguration( 1433 bool RTCPeerConnectionHandler::setConfiguration(
1397 const blink::WebRTCConfiguration& blink_config) { 1434 const blink::WebRTCConfiguration& blink_config,
1435 blink::WebRTCError& error) {
1398 DCHECK(thread_checker_.CalledOnValidThread()); 1436 DCHECK(thread_checker_.CalledOnValidThread());
1399 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setConfiguration"); 1437 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setConfiguration");
1400 GetNativeRtcConfiguration(blink_config, &configuration_); 1438 GetNativeRtcConfiguration(blink_config, &configuration_);
1401 1439
1402 if (peer_connection_tracker_) 1440 if (peer_connection_tracker_)
1403 peer_connection_tracker_->TrackSetConfiguration(this, configuration_); 1441 peer_connection_tracker_->TrackSetConfiguration(this, configuration_);
1404 1442
1405 return native_peer_connection_->SetConfiguration(configuration_); 1443 webrtc::RTCError webrtc_error;
1444 bool ret =
1445 native_peer_connection_->SetConfiguration(configuration_, &webrtc_error);
1446 ConvertToWebKitRTCError(webrtc_error, &error);
1447 return ret;
1406 } 1448 }
1407 1449
1408 bool RTCPeerConnectionHandler::addICECandidate( 1450 bool RTCPeerConnectionHandler::addICECandidate(
1409 const blink::WebRTCVoidRequest& request, 1451 const blink::WebRTCVoidRequest& request,
1410 const blink::WebRTCICECandidate& candidate) { 1452 const blink::WebRTCICECandidate& candidate) {
1411 DCHECK(thread_checker_.CalledOnValidThread()); 1453 DCHECK(thread_checker_.CalledOnValidThread());
1412 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addICECandidate"); 1454 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addICECandidate");
1413 // Libjingle currently does not accept callbacks for addICECandidate. 1455 // Libjingle currently does not accept callbacks for addICECandidate.
1414 // For that reason we are going to call callbacks from here. 1456 // For that reason we are going to call callbacks from here.
1415 1457
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 } 1997 }
1956 1998
1957 void RTCPeerConnectionHandler::ResetUMAStats() { 1999 void RTCPeerConnectionHandler::ResetUMAStats() {
1958 DCHECK(thread_checker_.CalledOnValidThread()); 2000 DCHECK(thread_checker_.CalledOnValidThread());
1959 num_local_candidates_ipv6_ = 0; 2001 num_local_candidates_ipv6_ = 0;
1960 num_local_candidates_ipv4_ = 0; 2002 num_local_candidates_ipv4_ = 0;
1961 ice_connection_checking_start_ = base::TimeTicks(); 2003 ice_connection_checking_start_ = base::TimeTicks();
1962 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); 2004 memset(ice_state_seen_, 0, sizeof(ice_state_seen_));
1963 } 2005 }
1964 } // namespace content 2006 } // namespace content
OLDNEW
« 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