| OLD | NEW |
| 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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 const base::WeakPtr<RTCPeerConnectionHandler> handler_; | 1112 const base::WeakPtr<RTCPeerConnectionHandler> handler_; |
| 1113 const scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 1113 const scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
| 1114 }; | 1114 }; |
| 1115 | 1115 |
| 1116 RTCPeerConnectionHandler::RTCPeerConnectionHandler( | 1116 RTCPeerConnectionHandler::RTCPeerConnectionHandler( |
| 1117 blink::WebRTCPeerConnectionHandlerClient* client, | 1117 blink::WebRTCPeerConnectionHandlerClient* client, |
| 1118 PeerConnectionDependencyFactory* dependency_factory) | 1118 PeerConnectionDependencyFactory* dependency_factory) |
| 1119 : client_(client), | 1119 : client_(client), |
| 1120 is_closed_(false), | 1120 is_closed_(false), |
| 1121 dependency_factory_(dependency_factory), | 1121 dependency_factory_(dependency_factory), |
| 1122 track_adapter_map_(new WebRtcMediaStreamTrackAdapterMap( |
| 1123 dependency_factory_, |
| 1124 base::ThreadTaskRunnerHandle::Get())), |
| 1122 weak_factory_(this) { | 1125 weak_factory_(this) { |
| 1123 CHECK(client_); | 1126 CHECK(client_); |
| 1124 GetPeerConnectionHandlers()->insert(this); | 1127 GetPeerConnectionHandlers()->insert(this); |
| 1125 } | 1128 } |
| 1126 | 1129 |
| 1127 RTCPeerConnectionHandler::~RTCPeerConnectionHandler() { | 1130 RTCPeerConnectionHandler::~RTCPeerConnectionHandler() { |
| 1128 DCHECK(thread_checker_.CalledOnValidThread()); | 1131 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1129 | 1132 |
| 1130 Stop(); | 1133 Stop(); |
| 1131 | 1134 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 } | 1549 } |
| 1547 } | 1550 } |
| 1548 | 1551 |
| 1549 if (peer_connection_tracker_) { | 1552 if (peer_connection_tracker_) { |
| 1550 peer_connection_tracker_->TrackAddStream( | 1553 peer_connection_tracker_->TrackAddStream( |
| 1551 this, stream, PeerConnectionTracker::SOURCE_LOCAL); | 1554 this, stream, PeerConnectionTracker::SOURCE_LOCAL); |
| 1552 } | 1555 } |
| 1553 | 1556 |
| 1554 PerSessionWebRTCAPIMetrics::GetInstance()->IncrementStreamCounter(); | 1557 PerSessionWebRTCAPIMetrics::GetInstance()->IncrementStreamCounter(); |
| 1555 | 1558 |
| 1556 local_streams_.push_back( | 1559 local_streams_.push_back(base::MakeUnique<WebRtcMediaStreamAdapter>( |
| 1557 base::MakeUnique<WebRtcMediaStreamAdapter>(stream, dependency_factory_)); | 1560 dependency_factory_, track_adapter_map_, stream)); |
| 1558 | 1561 |
| 1559 webrtc::MediaStreamInterface* webrtc_stream = | 1562 webrtc::MediaStreamInterface* webrtc_stream = |
| 1560 local_streams_.back()->webrtc_media_stream(); | 1563 local_streams_.back()->webrtc_media_stream(); |
| 1561 track_metrics_.AddStream(MediaStreamTrackMetrics::SENT_STREAM, | 1564 track_metrics_.AddStream(MediaStreamTrackMetrics::SENT_STREAM, |
| 1562 webrtc_stream); | 1565 webrtc_stream); |
| 1563 | 1566 |
| 1564 if (!options.IsEmpty()) { | 1567 if (!options.IsEmpty()) { |
| 1565 // TODO(perkj): |mediaConstraints| is the name of the optional constraints | 1568 // TODO(perkj): |mediaConstraints| is the name of the optional constraints |
| 1566 // argument in RTCPeerConnection.idl. It has been removed from the spec and | 1569 // argument in RTCPeerConnection.idl. It has been removed from the spec and |
| 1567 // should be removed from blink as well. | 1570 // should be removed from blink as well. |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 } | 2123 } |
| 2121 | 2124 |
| 2122 void RTCPeerConnectionHandler::ResetUMAStats() { | 2125 void RTCPeerConnectionHandler::ResetUMAStats() { |
| 2123 DCHECK(thread_checker_.CalledOnValidThread()); | 2126 DCHECK(thread_checker_.CalledOnValidThread()); |
| 2124 num_local_candidates_ipv6_ = 0; | 2127 num_local_candidates_ipv6_ = 0; |
| 2125 num_local_candidates_ipv4_ = 0; | 2128 num_local_candidates_ipv4_ = 0; |
| 2126 ice_connection_checking_start_ = base::TimeTicks(); | 2129 ice_connection_checking_start_ = base::TimeTicks(); |
| 2127 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 2130 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
| 2128 } | 2131 } |
| 2129 } // namespace content | 2132 } // namespace content |
| OLD | NEW |