OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 if (rtc::starts_with(data_desc->protocol().data(), | 1356 if (rtc::starts_with(data_desc->protocol().data(), |
1357 cricket::kMediaProtocolRtpPrefix)) { | 1357 cricket::kMediaProtocolRtpPrefix)) { |
1358 UpdateRemoteRtpDataChannels(GetActiveStreams(data_desc)); | 1358 UpdateRemoteRtpDataChannels(GetActiveStreams(data_desc)); |
1359 } | 1359 } |
1360 } | 1360 } |
1361 | 1361 |
1362 // Iterate new_streams and notify the observer about new MediaStreams. | 1362 // Iterate new_streams and notify the observer about new MediaStreams. |
1363 for (size_t i = 0; i < new_streams->count(); ++i) { | 1363 for (size_t i = 0; i < new_streams->count(); ++i) { |
1364 MediaStreamInterface* new_stream = new_streams->at(i); | 1364 MediaStreamInterface* new_stream = new_streams->at(i); |
1365 stats_->AddStream(new_stream); | 1365 stats_->AddStream(new_stream); |
1366 // Call both the raw pointer and scoped_refptr versions of the method | |
1367 // for compatibility. | |
1368 observer_->OnAddStream(new_stream); | |
1369 observer_->OnAddStream( | 1366 observer_->OnAddStream( |
1370 rtc::scoped_refptr<MediaStreamInterface>(new_stream)); | 1367 rtc::scoped_refptr<MediaStreamInterface>(new_stream)); |
1371 } | 1368 } |
1372 | 1369 |
1373 UpdateEndedRemoteMediaStreams(); | 1370 UpdateEndedRemoteMediaStreams(); |
1374 | 1371 |
1375 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); | 1372 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); |
1376 signaling_thread()->Post(RTC_FROM_HERE, this, | 1373 signaling_thread()->Post(RTC_FROM_HERE, this, |
1377 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); | 1374 MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); |
1378 } | 1375 } |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2073 std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams_to_remove; | 2070 std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams_to_remove; |
2074 for (size_t i = 0; i < remote_streams_->count(); ++i) { | 2071 for (size_t i = 0; i < remote_streams_->count(); ++i) { |
2075 MediaStreamInterface* stream = remote_streams_->at(i); | 2072 MediaStreamInterface* stream = remote_streams_->at(i); |
2076 if (stream->GetAudioTracks().empty() && stream->GetVideoTracks().empty()) { | 2073 if (stream->GetAudioTracks().empty() && stream->GetVideoTracks().empty()) { |
2077 streams_to_remove.push_back(stream); | 2074 streams_to_remove.push_back(stream); |
2078 } | 2075 } |
2079 } | 2076 } |
2080 | 2077 |
2081 for (auto& stream : streams_to_remove) { | 2078 for (auto& stream : streams_to_remove) { |
2082 remote_streams_->RemoveStream(stream); | 2079 remote_streams_->RemoveStream(stream); |
2083 // Call both the raw pointer and scoped_refptr versions of the method | |
2084 // for compatibility. | |
2085 observer_->OnRemoveStream(stream.get()); | |
2086 observer_->OnRemoveStream(std::move(stream)); | 2080 observer_->OnRemoveStream(std::move(stream)); |
2087 } | 2081 } |
2088 } | 2082 } |
2089 | 2083 |
2090 void PeerConnection::UpdateLocalTracks( | 2084 void PeerConnection::UpdateLocalTracks( |
2091 const std::vector<cricket::StreamParams>& streams, | 2085 const std::vector<cricket::StreamParams>& streams, |
2092 cricket::MediaType media_type) { | 2086 cricket::MediaType media_type) { |
2093 TrackInfos* current_tracks = GetLocalTracks(media_type); | 2087 TrackInfos* current_tracks = GetLocalTracks(media_type); |
2094 | 2088 |
2095 // Find removed tracks. I.e., tracks where the track id, stream label or ssrc | 2089 // Find removed tracks. I.e., tracks where the track id, stream label or ssrc |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 rtc::scoped_refptr<DataChannel> channel( | 2244 rtc::scoped_refptr<DataChannel> channel( |
2251 InternalCreateDataChannel(label, nullptr)); | 2245 InternalCreateDataChannel(label, nullptr)); |
2252 if (!channel.get()) { | 2246 if (!channel.get()) { |
2253 LOG(LS_WARNING) << "Remote peer requested a DataChannel but" | 2247 LOG(LS_WARNING) << "Remote peer requested a DataChannel but" |
2254 << "CreateDataChannel failed."; | 2248 << "CreateDataChannel failed."; |
2255 return; | 2249 return; |
2256 } | 2250 } |
2257 channel->SetReceiveSsrc(remote_ssrc); | 2251 channel->SetReceiveSsrc(remote_ssrc); |
2258 rtc::scoped_refptr<DataChannelInterface> proxy_channel = | 2252 rtc::scoped_refptr<DataChannelInterface> proxy_channel = |
2259 DataChannelProxy::Create(signaling_thread(), channel); | 2253 DataChannelProxy::Create(signaling_thread(), channel); |
2260 // Call both the raw pointer and scoped_refptr versions of the method | |
2261 // for compatibility. | |
2262 observer_->OnDataChannel(proxy_channel.get()); | |
2263 observer_->OnDataChannel(std::move(proxy_channel)); | 2254 observer_->OnDataChannel(std::move(proxy_channel)); |
2264 } | 2255 } |
2265 | 2256 |
2266 rtc::scoped_refptr<DataChannel> PeerConnection::InternalCreateDataChannel( | 2257 rtc::scoped_refptr<DataChannel> PeerConnection::InternalCreateDataChannel( |
2267 const std::string& label, | 2258 const std::string& label, |
2268 const InternalDataChannelInit* config) { | 2259 const InternalDataChannelInit* config) { |
2269 if (IsClosed()) { | 2260 if (IsClosed()) { |
2270 return nullptr; | 2261 return nullptr; |
2271 } | 2262 } |
2272 if (session_->data_channel_type() == cricket::DCT_NONE) { | 2263 if (session_->data_channel_type() == cricket::DCT_NONE) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 const InternalDataChannelInit& config) { | 2400 const InternalDataChannelInit& config) { |
2410 rtc::scoped_refptr<DataChannel> channel( | 2401 rtc::scoped_refptr<DataChannel> channel( |
2411 InternalCreateDataChannel(label, &config)); | 2402 InternalCreateDataChannel(label, &config)); |
2412 if (!channel.get()) { | 2403 if (!channel.get()) { |
2413 LOG(LS_ERROR) << "Failed to create DataChannel from the OPEN message."; | 2404 LOG(LS_ERROR) << "Failed to create DataChannel from the OPEN message."; |
2414 return; | 2405 return; |
2415 } | 2406 } |
2416 | 2407 |
2417 rtc::scoped_refptr<DataChannelInterface> proxy_channel = | 2408 rtc::scoped_refptr<DataChannelInterface> proxy_channel = |
2418 DataChannelProxy::Create(signaling_thread(), channel); | 2409 DataChannelProxy::Create(signaling_thread(), channel); |
2419 // Call both the raw pointer and scoped_refptr versions of the method | |
2420 // for compatibility. | |
2421 observer_->OnDataChannel(proxy_channel.get()); | |
2422 observer_->OnDataChannel(std::move(proxy_channel)); | 2410 observer_->OnDataChannel(std::move(proxy_channel)); |
2423 } | 2411 } |
2424 | 2412 |
2425 RtpSenderInternal* PeerConnection::FindSenderById(const std::string& id) { | 2413 RtpSenderInternal* PeerConnection::FindSenderById(const std::string& id) { |
2426 auto it = std::find_if( | 2414 auto it = std::find_if( |
2427 senders_.begin(), senders_.end(), | 2415 senders_.begin(), senders_.end(), |
2428 [id](const rtc::scoped_refptr< | 2416 [id](const rtc::scoped_refptr< |
2429 RtpSenderProxyWithInternal<RtpSenderInternal>>& sender) { | 2417 RtpSenderProxyWithInternal<RtpSenderInternal>>& sender) { |
2430 return sender->id() == id; | 2418 return sender->id() == id; |
2431 }); | 2419 }); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 } | 2557 } |
2570 return event_log_->StartLogging(file, max_size_bytes); | 2558 return event_log_->StartLogging(file, max_size_bytes); |
2571 } | 2559 } |
2572 | 2560 |
2573 void PeerConnection::StopRtcEventLog_w() { | 2561 void PeerConnection::StopRtcEventLog_w() { |
2574 if (event_log_) { | 2562 if (event_log_) { |
2575 event_log_->StopLogging(); | 2563 event_log_->StopLogging(); |
2576 } | 2564 } |
2577 } | 2565 } |
2578 } // namespace webrtc | 2566 } // namespace webrtc |
OLD | NEW |