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

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

Issue 396193005: Converts RTCOfferOptions to constriants in the glue code for createOffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix sync Created 6 years, 4 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "content/renderer/media/peer_connection_tracker.h" 4 #include "content/renderer/media/peer_connection_tracker.h"
5 5
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/common/media/peer_connection_tracker_messages.h" 7 #include "content/common/media/peer_connection_tracker_messages.h"
8 #include "content/renderer/media/rtc_media_constraints.h" 8 #include "content/renderer/media/rtc_media_constraints.h"
9 #include "content/renderer/media/rtc_peer_connection_handler.h" 9 #include "content/renderer/media/rtc_peer_connection_handler.h"
10 #include "content/renderer/render_thread_impl.h" 10 #include "content/renderer/render_thread_impl.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 for (size_t i = 0; i < tracks.size(); ++i) { 114 for (size_t i = 0; i < tracks.size(); ++i) {
115 result += SerializeMediaStreamComponent(tracks[i]); 115 result += SerializeMediaStreamComponent(tracks[i]);
116 if (i != tracks.size() - 1) 116 if (i != tracks.size() - 1)
117 result += ", "; 117 result += ", ";
118 } 118 }
119 result += "]"; 119 result += "]";
120 } 120 }
121 return result; 121 return result;
122 } 122 }
123 123
124 static std::string SerializeIceTransportType(
125 webrtc::PeerConnectionInterface::IceTransportsType type) {
126 string transport_type;
127 switch (type) {
128 case webrtc::PeerConnectionInterface::kNone:
129 transport_type = "none";
130 break;
131 case webrtc::PeerConnectionInterface::kRelay:
132 transport_type = "relay";
133 break;
134 case webrtc::PeerConnectionInterface::kAll:
135 transport_type = "all";
136 break;
137 case webrtc::PeerConnectionInterface::kNoHost:
138 transport_type = "noHost";
139 break;
140 default:
141 NOTREACHED();
142 };
143 return transport_type;
144 }
145
124 #define GET_STRING_OF_STATE(state) \ 146 #define GET_STRING_OF_STATE(state) \
125 case WebRTCPeerConnectionHandlerClient::state: \ 147 case WebRTCPeerConnectionHandlerClient::state: \
126 result = #state; \ 148 result = #state; \
127 break; 149 break;
128 150
129 static string GetSignalingStateString( 151 static string GetSignalingStateString(
130 WebRTCPeerConnectionHandlerClient::SignalingState state) { 152 WebRTCPeerConnectionHandlerClient::SignalingState state) {
131 string result; 153 string result;
132 switch (state) { 154 switch (state) {
133 GET_STRING_OF_STATE(SignalingStateStable) 155 GET_STRING_OF_STATE(SignalingStateStable)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 292
271 it->first->GetStats( 293 it->first->GetStats(
272 observer, 294 observer,
273 NULL, 295 NULL,
274 webrtc::PeerConnectionInterface::kStatsOutputLevelDebug); 296 webrtc::PeerConnectionInterface::kStatsOutputLevelDebug);
275 } 297 }
276 } 298 }
277 299
278 void PeerConnectionTracker::RegisterPeerConnection( 300 void PeerConnectionTracker::RegisterPeerConnection(
279 RTCPeerConnectionHandler* pc_handler, 301 RTCPeerConnectionHandler* pc_handler,
280 const std::vector<webrtc::PeerConnectionInterface::IceServer>& servers, 302 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
281 const RTCMediaConstraints& constraints, 303 const RTCMediaConstraints& constraints,
282 const blink::WebFrame* frame) { 304 const blink::WebFrame* frame) {
283 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; 305 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()";
284 PeerConnectionInfo info; 306 PeerConnectionInfo info;
285 307
286 info.lid = GetNextLocalID(); 308 info.lid = GetNextLocalID();
287 info.servers = SerializeServers(servers); 309 info.rtc_configuration =
310 "{ servers: " + SerializeServers(config.servers) + ", " +
311 "iceTransportType: " + SerializeIceTransportType(config.type) + " }";
312
288 info.constraints = SerializeMediaConstraints(constraints); 313 info.constraints = SerializeMediaConstraints(constraints);
289 info.url = frame->document().url().spec(); 314 info.url = frame->document().url().spec();
290 RenderThreadImpl::current()->Send( 315 RenderThreadImpl::current()->Send(
291 new PeerConnectionTrackerHost_AddPeerConnection(info)); 316 new PeerConnectionTrackerHost_AddPeerConnection(info));
292 317
293 DCHECK(peer_connection_id_map_.find(pc_handler) == 318 DCHECK(peer_connection_id_map_.find(pc_handler) ==
294 peer_connection_id_map_.end()); 319 peer_connection_id_map_.end());
295 peer_connection_id_map_[pc_handler] = info.lid; 320 peer_connection_id_map_[pc_handler] = info.lid;
296 } 321 }
297 322
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 364
340 string value = "type: " + type + ", sdp: " + sdp; 365 string value = "type: " + type + ", sdp: " + sdp;
341 SendPeerConnectionUpdate( 366 SendPeerConnectionUpdate(
342 pc_handler, 367 pc_handler,
343 source == SOURCE_LOCAL ? "setLocalDescription" : "setRemoteDescription", 368 source == SOURCE_LOCAL ? "setLocalDescription" : "setRemoteDescription",
344 value); 369 value);
345 } 370 }
346 371
347 void PeerConnectionTracker::TrackUpdateIce( 372 void PeerConnectionTracker::TrackUpdateIce(
348 RTCPeerConnectionHandler* pc_handler, 373 RTCPeerConnectionHandler* pc_handler,
349 const std::vector<webrtc::PeerConnectionInterface::IceServer>& servers, 374 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
350 const RTCMediaConstraints& options) { 375 const RTCMediaConstraints& options) {
351 string servers_string = "servers: " + SerializeServers(servers); 376 string servers_string = "servers: " + SerializeServers(config.servers);
377
378 string transport_type =
379 "iceTransportType: " + SerializeIceTransportType(config.type);
380
352 string constraints = 381 string constraints =
353 "constraints: {" + SerializeMediaConstraints(options) + "}"; 382 "constraints: {" + SerializeMediaConstraints(options) + "}";
354 383
355 SendPeerConnectionUpdate( 384 SendPeerConnectionUpdate(
356 pc_handler, "updateIce", servers_string + ", " + constraints); 385 pc_handler,
386 "updateIce",
387 servers_string + ", " + transport_type + ", " + constraints);
357 } 388 }
358 389
359 void PeerConnectionTracker::TrackAddIceCandidate( 390 void PeerConnectionTracker::TrackAddIceCandidate(
360 RTCPeerConnectionHandler* pc_handler, 391 RTCPeerConnectionHandler* pc_handler,
361 const blink::WebRTCICECandidate& candidate, 392 const blink::WebRTCICECandidate& candidate,
362 Source source) { 393 Source source) {
363 string value = "mid: " + base::UTF16ToUTF8(candidate.sdpMid()) + ", " + 394 string value = "mid: " + base::UTF16ToUTF8(candidate.sdpMid()) + ", " +
364 "candidate: " + base::UTF16ToUTF8(candidate.candidate()); 395 "candidate: " + base::UTF16ToUTF8(candidate.candidate());
365 SendPeerConnectionUpdate( 396 SendPeerConnectionUpdate(
366 pc_handler, 397 pc_handler,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 const std::string& value) { 518 const std::string& value) {
488 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) 519 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end())
489 return; 520 return;
490 521
491 RenderThreadImpl::current()->Send( 522 RenderThreadImpl::current()->Send(
492 new PeerConnectionTrackerHost_UpdatePeerConnection( 523 new PeerConnectionTrackerHost_UpdatePeerConnection(
493 peer_connection_id_map_[pc_handler], type, value)); 524 peer_connection_id_map_[pc_handler], type, value));
494 } 525 }
495 526
496 } // namespace content 527 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/peer_connection_tracker.h ('k') | content/renderer/media/rtc_peer_connection_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698