Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 return result; | 43 return result; |
| 44 } | 44 } |
| 45 | 45 |
| 46 static RTCMediaConstraints GetNativeMediaConstraints( | 46 static RTCMediaConstraints GetNativeMediaConstraints( |
| 47 const blink::WebMediaConstraints& constraints) { | 47 const blink::WebMediaConstraints& constraints) { |
| 48 RTCMediaConstraints native_constraints; | 48 RTCMediaConstraints native_constraints; |
| 49 | 49 |
| 50 if (constraints.isNull()) | 50 if (constraints.isNull()) |
| 51 return native_constraints; | 51 return native_constraints; |
| 52 | 52 |
| 53 #if 0 | |
|
mcasas
2016/01/26 16:08:02
Please remove this before committing.
hta - Chromium
2016/01/26 19:35:25
Change undone - will be done properly in later CL.
| |
| 54 // TODO(hta): Return something stringifiable for new-style constraints. | |
| 55 // For now, return as if constraints were empty. | |
|
mcasas
2016/01/26 16:08:02
TODO()s must have a http://crbug.com/... bug assoc
hta - Chromium
2016/01/26 19:35:25
Acknowledged.
| |
| 53 blink::WebVector<blink::WebMediaConstraint> mandatory; | 56 blink::WebVector<blink::WebMediaConstraint> mandatory; |
| 54 constraints.getMandatoryConstraints(mandatory); | 57 constraints.getMandatoryConstraints(mandatory); |
| 55 for (size_t i = 0; i < mandatory.size(); ++i) { | 58 for (size_t i = 0; i < mandatory.size(); ++i) { |
| 56 native_constraints.AddMandatory( | 59 native_constraints.AddMandatory( |
| 57 mandatory[i].m_name.utf8(), mandatory[i].m_value.utf8(), false); | 60 mandatory[i].m_name.utf8(), mandatory[i].m_value.utf8(), false); |
| 58 } | 61 } |
| 59 | 62 |
| 60 blink::WebVector<blink::WebMediaConstraint> optional; | 63 blink::WebVector<blink::WebMediaConstraint> optional; |
| 61 constraints.getOptionalConstraints(optional); | 64 constraints.getOptionalConstraints(optional); |
| 62 for (size_t i = 0; i < optional.size(); ++i) { | 65 for (size_t i = 0; i < optional.size(); ++i) { |
| 63 native_constraints.AddOptional( | 66 native_constraints.AddOptional( |
| 64 optional[i].m_name.utf8(), optional[i].m_value.utf8(), false); | 67 optional[i].m_name.utf8(), optional[i].m_value.utf8(), false); |
| 65 } | 68 } |
| 69 #endif | |
| 66 return native_constraints; | 70 return native_constraints; |
| 67 } | 71 } |
| 68 | 72 |
| 69 static string SerializeMediaConstraints( | 73 static string SerializeMediaConstraints( |
| 70 const RTCMediaConstraints& constraints) { | 74 const RTCMediaConstraints& constraints) { |
| 71 string result; | 75 string result; |
| 72 MediaConstraintsInterface::Constraints mandatory = constraints.GetMandatory(); | 76 MediaConstraintsInterface::Constraints mandatory = constraints.GetMandatory(); |
| 73 if (!mandatory.empty()) { | 77 if (!mandatory.empty()) { |
| 74 result += "mandatory: {"; | 78 result += "mandatory: {"; |
| 75 for (size_t i = 0; i < mandatory.size(); ++i) { | 79 for (size_t i = 0; i < mandatory.size(); ++i) { |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 DCHECK(main_thread_.CalledOnValidThread()); | 652 DCHECK(main_thread_.CalledOnValidThread()); |
| 649 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) | 653 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) |
| 650 return; | 654 return; |
| 651 | 655 |
| 652 RenderThreadImpl::current()->Send( | 656 RenderThreadImpl::current()->Send( |
| 653 new PeerConnectionTrackerHost_UpdatePeerConnection( | 657 new PeerConnectionTrackerHost_UpdatePeerConnection( |
| 654 peer_connection_id_map_[pc_handler], type, value)); | 658 peer_connection_id_map_[pc_handler], type, value)); |
| 655 } | 659 } |
| 656 | 660 |
| 657 } // namespace content | 661 } // namespace content |
| OLD | NEW |