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

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

Issue 862163004: Connect the BundlePolicy code in WebRTC to the BundlePolicy in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | content/renderer/media/rtc_peer_connection_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "content/common/media/peer_connection_tracker_messages.h" 9 #include "content/common/media/peer_connection_tracker_messages.h"
10 #include "content/renderer/media/rtc_media_constraints.h" 10 #include "content/renderer/media/rtc_media_constraints.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 break; 138 break;
139 case webrtc::PeerConnectionInterface::kNoHost: 139 case webrtc::PeerConnectionInterface::kNoHost:
140 transport_type = "noHost"; 140 transport_type = "noHost";
141 break; 141 break;
142 default: 142 default:
143 NOTREACHED(); 143 NOTREACHED();
144 }; 144 };
145 return transport_type; 145 return transport_type;
146 } 146 }
147 147
148 static std::string SerializeBundlePolicy(
149 webrtc::PeerConnectionInterface::BundlePolicy policy) {
150 string policy_str;
151 switch (policy) {
152 case webrtc::PeerConnectionInterface::kBundlePolicyBalanced:
153 policy_str = "balanced";
154 break;
155 case webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle:
156 policy_str = "max-bundle";
157 break;
158 case webrtc::PeerConnectionInterface::kBundlePolicyMaxCompat:
159 policy_str = "max-compat";
160 break;
161 default:
162 NOTREACHED();
163 };
164 return policy_str;
165 }
166
148 #define GET_STRING_OF_STATE(state) \ 167 #define GET_STRING_OF_STATE(state) \
149 case WebRTCPeerConnectionHandlerClient::state: \ 168 case WebRTCPeerConnectionHandlerClient::state: \
150 result = #state; \ 169 result = #state; \
151 break; 170 break;
152 171
153 static string GetSignalingStateString( 172 static string GetSignalingStateString(
154 WebRTCPeerConnectionHandlerClient::SignalingState state) { 173 WebRTCPeerConnectionHandlerClient::SignalingState state) {
155 string result; 174 string result;
156 switch (state) { 175 switch (state) {
157 GET_STRING_OF_STATE(SignalingStateStable) 176 GET_STRING_OF_STATE(SignalingStateStable)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 const webrtc::PeerConnectionInterface::RTCConfiguration& config, 351 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
333 const RTCMediaConstraints& constraints, 352 const RTCMediaConstraints& constraints,
334 const blink::WebFrame* frame) { 353 const blink::WebFrame* frame) {
335 DCHECK(main_thread_.CalledOnValidThread()); 354 DCHECK(main_thread_.CalledOnValidThread());
336 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; 355 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()";
337 PeerConnectionInfo info; 356 PeerConnectionInfo info;
338 357
339 info.lid = GetNextLocalID(); 358 info.lid = GetNextLocalID();
340 info.rtc_configuration = 359 info.rtc_configuration =
341 "{ servers: " + SerializeServers(config.servers) + ", " + 360 "{ servers: " + SerializeServers(config.servers) + ", " +
342 "iceTransportType: " + SerializeIceTransportType(config.type) + " }"; 361 "iceTransportType: " + SerializeIceTransportType(config.type) + ", " +
362 "bundlePolicy: " + SerializeBundlePolicy(config.bundle_policy) + " }";
343 363
344 info.constraints = SerializeMediaConstraints(constraints); 364 info.constraints = SerializeMediaConstraints(constraints);
345 info.url = frame->document().url().spec(); 365 info.url = frame->document().url().spec();
346 RenderThreadImpl::current()->Send( 366 RenderThreadImpl::current()->Send(
347 new PeerConnectionTrackerHost_AddPeerConnection(info)); 367 new PeerConnectionTrackerHost_AddPeerConnection(info));
348 368
349 DCHECK(peer_connection_id_map_.find(pc_handler) == 369 DCHECK(peer_connection_id_map_.find(pc_handler) ==
350 peer_connection_id_map_.end()); 370 peer_connection_id_map_.end());
351 peer_connection_id_map_[pc_handler] = info.lid; 371 peer_connection_id_map_[pc_handler] = info.lid;
352 } 372 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 void PeerConnectionTracker::TrackUpdateIce( 423 void PeerConnectionTracker::TrackUpdateIce(
404 RTCPeerConnectionHandler* pc_handler, 424 RTCPeerConnectionHandler* pc_handler,
405 const webrtc::PeerConnectionInterface::RTCConfiguration& config, 425 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
406 const RTCMediaConstraints& options) { 426 const RTCMediaConstraints& options) {
407 DCHECK(main_thread_.CalledOnValidThread()); 427 DCHECK(main_thread_.CalledOnValidThread());
408 string servers_string = "servers: " + SerializeServers(config.servers); 428 string servers_string = "servers: " + SerializeServers(config.servers);
409 429
410 string transport_type = 430 string transport_type =
411 "iceTransportType: " + SerializeIceTransportType(config.type); 431 "iceTransportType: " + SerializeIceTransportType(config.type);
412 432
433 string bundle_policy =
434 "bundlePolicy: " + SerializeBundlePolicy(config.bundle_policy);
435
413 string constraints = 436 string constraints =
414 "constraints: {" + SerializeMediaConstraints(options) + "}"; 437 "constraints: {" + SerializeMediaConstraints(options) + "}";
415 438
416 SendPeerConnectionUpdate( 439 SendPeerConnectionUpdate(
417 pc_handler, 440 pc_handler,
418 "updateIce", 441 "updateIce",
419 servers_string + ", " + transport_type + ", " + constraints); 442 servers_string + ", " + transport_type + ", " +
443 bundle_policy + ", " + constraints);
420 } 444 }
421 445
422 void PeerConnectionTracker::TrackAddIceCandidate( 446 void PeerConnectionTracker::TrackAddIceCandidate(
423 RTCPeerConnectionHandler* pc_handler, 447 RTCPeerConnectionHandler* pc_handler,
424 const blink::WebRTCICECandidate& candidate, 448 const blink::WebRTCICECandidate& candidate,
425 Source source, 449 Source source,
426 bool succeeded) { 450 bool succeeded) {
427 DCHECK(main_thread_.CalledOnValidThread()); 451 DCHECK(main_thread_.CalledOnValidThread());
428 string value = 452 string value =
429 "sdpMid: " + base::UTF16ToUTF8(candidate.sdpMid()) + ", " + 453 "sdpMid: " + base::UTF16ToUTF8(candidate.sdpMid()) + ", " +
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 DCHECK(main_thread_.CalledOnValidThread()); 598 DCHECK(main_thread_.CalledOnValidThread());
575 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) 599 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end())
576 return; 600 return;
577 601
578 RenderThreadImpl::current()->Send( 602 RenderThreadImpl::current()->Send(
579 new PeerConnectionTrackerHost_UpdatePeerConnection( 603 new PeerConnectionTrackerHost_UpdatePeerConnection(
580 peer_connection_id_map_[pc_handler], type, value)); 604 peer_connection_id_map_[pc_handler], type, value));
581 } 605 }
582 606
583 } // namespace content 607 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/rtc_peer_connection_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698