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

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: 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 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:
195 // If adding a new error type, need 3 CLs: One to add the enum to webrtc,
196 // one to update this mapping code, and one to start using the enum in
197 // webrtc.
198 NOTREACHED() << "webrtc::RTCErrorType " << webrtc_error.type()
199 << " not covered by switch statement.";
200 break;
201 }
202 }
203
163 void RunClosureWithTrace(const base::Closure& closure, 204 void RunClosureWithTrace(const base::Closure& closure,
164 const char* trace_event_name) { 205 const char* trace_event_name) {
165 TRACE_EVENT0("webrtc", trace_event_name); 206 TRACE_EVENT0("webrtc", trace_event_name);
166 closure.Run(); 207 closure.Run();
167 } 208 }
168 209
169 void RunSynchronousClosure(const base::Closure& closure, 210 void RunSynchronousClosure(const base::Closure& closure,
170 const char* trace_event_name, 211 const char* trace_event_name,
171 base::WaitableEvent* event) { 212 base::WaitableEvent* event) {
172 { 213 {
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 base::Bind(&webrtc::PeerConnectionInterface::remote_description, 1427 base::Bind(&webrtc::PeerConnectionInterface::remote_description,
1387 native_peer_connection_); 1428 native_peer_connection_);
1388 RunSynchronousClosureOnSignalingThread( 1429 RunSynchronousClosureOnSignalingThread(
1389 base::Bind(&GetSdpAndTypeFromSessionDescription, description_cb, 1430 base::Bind(&GetSdpAndTypeFromSessionDescription, description_cb,
1390 base::Unretained(&sdp), base::Unretained(&type)), 1431 base::Unretained(&sdp), base::Unretained(&type)),
1391 "remoteDescription"); 1432 "remoteDescription");
1392 1433
1393 return CreateWebKitSessionDescription(sdp, type); 1434 return CreateWebKitSessionDescription(sdp, type);
1394 } 1435 }
1395 1436
1396 bool RTCPeerConnectionHandler::setConfiguration( 1437 blink::WebRTCErrorType RTCPeerConnectionHandler::setConfiguration(
1397 const blink::WebRTCConfiguration& blink_config) { 1438 const blink::WebRTCConfiguration& blink_config) {
1398 DCHECK(thread_checker_.CalledOnValidThread()); 1439 DCHECK(thread_checker_.CalledOnValidThread());
1399 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setConfiguration"); 1440 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::setConfiguration");
1400 GetNativeRtcConfiguration(blink_config, &configuration_); 1441 GetNativeRtcConfiguration(blink_config, &configuration_);
1401 1442
1402 if (peer_connection_tracker_) 1443 if (peer_connection_tracker_)
1403 peer_connection_tracker_->TrackSetConfiguration(this, configuration_); 1444 peer_connection_tracker_->TrackSetConfiguration(this, configuration_);
1404 1445
1405 return native_peer_connection_->SetConfiguration(configuration_); 1446 webrtc::RTCError webrtc_error;
1447 blink::WebRTCError blink_error;
1448 bool ret =
1449 native_peer_connection_->SetConfiguration(configuration_, &webrtc_error);
1450 // The boolean return value is made redundant by the error output param; just
1451 // DCHECK that they're consistent.
1452 DCHECK_EQ(ret, webrtc_error.type() == webrtc::RTCErrorType::NONE);
1453 ConvertToWebKitRTCError(webrtc_error, &blink_error);
1454 return blink_error.type();
1406 } 1455 }
1407 1456
1408 bool RTCPeerConnectionHandler::addICECandidate( 1457 bool RTCPeerConnectionHandler::addICECandidate(
1409 const blink::WebRTCVoidRequest& request, 1458 const blink::WebRTCVoidRequest& request,
1410 const blink::WebRTCICECandidate& candidate) { 1459 const blink::WebRTCICECandidate& candidate) {
1411 DCHECK(thread_checker_.CalledOnValidThread()); 1460 DCHECK(thread_checker_.CalledOnValidThread());
1412 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addICECandidate"); 1461 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::addICECandidate");
1413 // Libjingle currently does not accept callbacks for addICECandidate. 1462 // Libjingle currently does not accept callbacks for addICECandidate.
1414 // For that reason we are going to call callbacks from here. 1463 // For that reason we are going to call callbacks from here.
1415 1464
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 } 2004 }
1956 2005
1957 void RTCPeerConnectionHandler::ResetUMAStats() { 2006 void RTCPeerConnectionHandler::ResetUMAStats() {
1958 DCHECK(thread_checker_.CalledOnValidThread()); 2007 DCHECK(thread_checker_.CalledOnValidThread());
1959 num_local_candidates_ipv6_ = 0; 2008 num_local_candidates_ipv6_ = 0;
1960 num_local_candidates_ipv4_ = 0; 2009 num_local_candidates_ipv4_ = 0;
1961 ice_connection_checking_start_ = base::TimeTicks(); 2010 ice_connection_checking_start_ = base::TimeTicks();
1962 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); 2011 memset(ice_state_seen_, 0, sizeof(ice_state_seen_));
1963 } 2012 }
1964 } // namespace content 2013 } // 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