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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 // there. | 585 // there. |
586 if (!network_thread()->Invoke<bool>( | 586 if (!network_thread()->Invoke<bool>( |
587 RTC_FROM_HERE, rtc::Bind(&PeerConnection::InitializePortAllocator_n, | 587 RTC_FROM_HERE, rtc::Bind(&PeerConnection::InitializePortAllocator_n, |
588 this, configuration))) { | 588 this, configuration))) { |
589 return false; | 589 return false; |
590 } | 590 } |
591 | 591 |
592 media_controller_.reset( | 592 media_controller_.reset( |
593 factory_->CreateMediaController(configuration.media_config)); | 593 factory_->CreateMediaController(configuration.media_config)); |
594 | 594 |
595 session_.reset( | 595 session_.reset(new WebRtcSession( |
596 new WebRtcSession(media_controller_.get(), factory_->network_thread(), | 596 media_controller_.get(), factory_->network_thread(), |
597 factory_->worker_thread(), factory_->signaling_thread(), | 597 factory_->worker_thread(), factory_->signaling_thread(), |
598 port_allocator_.get())); | 598 port_allocator_.get(), |
599 factory_->CreateTransportController(port_allocator_.get()))); | |
600 | |
599 stats_.reset(new StatsCollector(this)); | 601 stats_.reset(new StatsCollector(this)); |
600 | 602 |
601 // Initialize the WebRtcSession. It creates transport channels etc. | 603 // Initialize the WebRtcSession. It creates transport channels etc. |
602 if (!session_->Initialize(factory_->options(), std::move(cert_generator), | 604 if (!session_->Initialize(factory_->options(), std::move(cert_generator), |
603 configuration)) { | 605 configuration)) { |
604 return false; | 606 return false; |
605 } | 607 } |
606 | 608 |
607 // Register PeerConnection as receiver of local ice candidates. | 609 // Register PeerConnection as receiver of local ice candidates. |
608 // All the callbacks will be posted to the application from PeerConnection. | 610 // All the callbacks will be posted to the application from PeerConnection. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
759 (*it)->internal()->Stop(); | 761 (*it)->internal()->Stop(); |
760 senders_.erase(it); | 762 senders_.erase(it); |
761 | 763 |
762 observer_->OnRenegotiationNeeded(); | 764 observer_->OnRenegotiationNeeded(); |
763 return true; | 765 return true; |
764 } | 766 } |
765 | 767 |
766 rtc::scoped_refptr<DtmfSenderInterface> PeerConnection::CreateDtmfSender( | 768 rtc::scoped_refptr<DtmfSenderInterface> PeerConnection::CreateDtmfSender( |
767 AudioTrackInterface* track) { | 769 AudioTrackInterface* track) { |
768 TRACE_EVENT0("webrtc", "PeerConnection::CreateDtmfSender"); | 770 TRACE_EVENT0("webrtc", "PeerConnection::CreateDtmfSender"); |
771 if (IsClosed()) { | |
772 return nullptr; | |
773 } | |
769 if (!track) { | 774 if (!track) { |
770 LOG(LS_ERROR) << "CreateDtmfSender - track is NULL."; | 775 LOG(LS_ERROR) << "CreateDtmfSender - track is NULL."; |
771 return NULL; | 776 return NULL; |
772 } | 777 } |
773 if (!local_streams_->FindAudioTrack(track->id())) { | 778 if (!local_streams_->FindAudioTrack(track->id())) { |
774 LOG(LS_ERROR) << "CreateDtmfSender is called with a non local audio track."; | 779 LOG(LS_ERROR) << "CreateDtmfSender is called with a non local audio track."; |
775 return NULL; | 780 return NULL; |
776 } | 781 } |
777 | 782 |
778 rtc::scoped_refptr<DtmfSenderInterface> sender( | 783 rtc::scoped_refptr<DtmfSenderInterface> sender( |
779 DtmfSender::Create(track, signaling_thread(), session_.get())); | 784 DtmfSender::Create(track, signaling_thread(), session_.get())); |
780 if (!sender.get()) { | 785 if (!sender.get()) { |
781 LOG(LS_ERROR) << "CreateDtmfSender failed on DtmfSender::Create."; | 786 LOG(LS_ERROR) << "CreateDtmfSender failed on DtmfSender::Create."; |
782 return NULL; | 787 return NULL; |
783 } | 788 } |
784 return DtmfSenderProxy::Create(signaling_thread(), sender.get()); | 789 return DtmfSenderProxy::Create(signaling_thread(), sender.get()); |
785 } | 790 } |
786 | 791 |
787 rtc::scoped_refptr<RtpSenderInterface> PeerConnection::CreateSender( | 792 rtc::scoped_refptr<RtpSenderInterface> PeerConnection::CreateSender( |
788 const std::string& kind, | 793 const std::string& kind, |
789 const std::string& stream_id) { | 794 const std::string& stream_id) { |
790 TRACE_EVENT0("webrtc", "PeerConnection::CreateSender"); | 795 TRACE_EVENT0("webrtc", "PeerConnection::CreateSender"); |
796 if (IsClosed()) { | |
797 return nullptr; | |
798 } | |
791 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender; | 799 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender; |
792 if (kind == MediaStreamTrackInterface::kAudioKind) { | 800 if (kind == MediaStreamTrackInterface::kAudioKind) { |
793 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 801 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
794 signaling_thread(), new AudioRtpSender(session_.get(), stats_.get())); | 802 signaling_thread(), new AudioRtpSender(session_.get(), stats_.get())); |
795 } else if (kind == MediaStreamTrackInterface::kVideoKind) { | 803 } else if (kind == MediaStreamTrackInterface::kVideoKind) { |
796 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 804 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
797 signaling_thread(), new VideoRtpSender(session_.get())); | 805 signaling_thread(), new VideoRtpSender(session_.get())); |
798 } else { | 806 } else { |
799 LOG(LS_ERROR) << "CreateSender called with invalid kind: " << kind; | 807 LOG(LS_ERROR) << "CreateSender called with invalid kind: " << kind; |
800 return new_sender; | 808 return new_sender; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
991 return; | 999 return; |
992 } | 1000 } |
993 | 1001 |
994 session_->CreateAnswer(observer, session_options); | 1002 session_->CreateAnswer(observer, session_options); |
995 } | 1003 } |
996 | 1004 |
997 void PeerConnection::SetLocalDescription( | 1005 void PeerConnection::SetLocalDescription( |
998 SetSessionDescriptionObserver* observer, | 1006 SetSessionDescriptionObserver* observer, |
999 SessionDescriptionInterface* desc) { | 1007 SessionDescriptionInterface* desc) { |
1000 TRACE_EVENT0("webrtc", "PeerConnection::SetLocalDescription"); | 1008 TRACE_EVENT0("webrtc", "PeerConnection::SetLocalDescription"); |
1009 if (IsClosed()) { | |
1010 return; | |
1011 } | |
1001 if (!VERIFY(observer != nullptr)) { | 1012 if (!VERIFY(observer != nullptr)) { |
1002 LOG(LS_ERROR) << "SetLocalDescription - observer is NULL."; | 1013 LOG(LS_ERROR) << "SetLocalDescription - observer is NULL."; |
1003 return; | 1014 return; |
1004 } | 1015 } |
1005 if (!desc) { | 1016 if (!desc) { |
1006 PostSetSessionDescriptionFailure(observer, "SessionDescription is NULL."); | 1017 PostSetSessionDescriptionFailure(observer, "SessionDescription is NULL."); |
1007 return; | 1018 return; |
1008 } | 1019 } |
1009 // Update stats here so that we have the most recent stats for tracks and | 1020 // Update stats here so that we have the most recent stats for tracks and |
1010 // streams that might be removed by updating the session description. | 1021 // streams that might be removed by updating the session description. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1070 // MaybeStartGathering needs to be called after posting | 1081 // MaybeStartGathering needs to be called after posting |
1071 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates | 1082 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates |
1072 // before signaling that SetLocalDescription completed. | 1083 // before signaling that SetLocalDescription completed. |
1073 session_->MaybeStartGathering(); | 1084 session_->MaybeStartGathering(); |
1074 } | 1085 } |
1075 | 1086 |
1076 void PeerConnection::SetRemoteDescription( | 1087 void PeerConnection::SetRemoteDescription( |
1077 SetSessionDescriptionObserver* observer, | 1088 SetSessionDescriptionObserver* observer, |
1078 SessionDescriptionInterface* desc) { | 1089 SessionDescriptionInterface* desc) { |
1079 TRACE_EVENT0("webrtc", "PeerConnection::SetRemoteDescription"); | 1090 TRACE_EVENT0("webrtc", "PeerConnection::SetRemoteDescription"); |
1091 if (IsClosed()) { | |
1092 return; | |
1093 } | |
1080 if (!VERIFY(observer != nullptr)) { | 1094 if (!VERIFY(observer != nullptr)) { |
1081 LOG(LS_ERROR) << "SetRemoteDescription - observer is NULL."; | 1095 LOG(LS_ERROR) << "SetRemoteDescription - observer is NULL."; |
1082 return; | 1096 return; |
1083 } | 1097 } |
1084 if (!desc) { | 1098 if (!desc) { |
1085 PostSetSessionDescriptionFailure(observer, "SessionDescription is NULL."); | 1099 PostSetSessionDescriptionFailure(observer, "SessionDescription is NULL."); |
1086 return; | 1100 return; |
1087 } | 1101 } |
1088 // Update stats here so that we have the most recent stats for tracks and | 1102 // Update stats here so that we have the most recent stats for tracks and |
1089 // streams that might be removed by updating the session description. | 1103 // streams that might be removed by updating the session description. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1192 } | 1206 } |
1193 | 1207 |
1194 // TODO(deadbeef): Shouldn't have to hop to the worker thread twice... | 1208 // TODO(deadbeef): Shouldn't have to hop to the worker thread twice... |
1195 session_->SetIceConfig(session_->ParseIceConfig(configuration)); | 1209 session_->SetIceConfig(session_->ParseIceConfig(configuration)); |
1196 return true; | 1210 return true; |
1197 } | 1211 } |
1198 | 1212 |
1199 bool PeerConnection::AddIceCandidate( | 1213 bool PeerConnection::AddIceCandidate( |
1200 const IceCandidateInterface* ice_candidate) { | 1214 const IceCandidateInterface* ice_candidate) { |
1201 TRACE_EVENT0("webrtc", "PeerConnection::AddIceCandidate"); | 1215 TRACE_EVENT0("webrtc", "PeerConnection::AddIceCandidate"); |
1216 if (IsClosed()) { | |
1217 return false; | |
1218 } | |
1202 return session_->ProcessIceMessage(ice_candidate); | 1219 return session_->ProcessIceMessage(ice_candidate); |
1203 } | 1220 } |
1204 | 1221 |
1205 bool PeerConnection::RemoveIceCandidates( | 1222 bool PeerConnection::RemoveIceCandidates( |
1206 const std::vector<cricket::Candidate>& candidates) { | 1223 const std::vector<cricket::Candidate>& candidates) { |
1207 TRACE_EVENT0("webrtc", "PeerConnection::RemoveIceCandidates"); | 1224 TRACE_EVENT0("webrtc", "PeerConnection::RemoveIceCandidates"); |
1208 return session_->RemoveRemoteIceCandidates(candidates); | 1225 return session_->RemoveRemoteIceCandidates(candidates); |
1209 } | 1226 } |
1210 | 1227 |
1211 void PeerConnection::RegisterUMAObserver(UMAObserver* observer) { | 1228 void PeerConnection::RegisterUMAObserver(UMAObserver* observer) { |
(...skipping 24 matching lines...) Expand all Loading... | |
1236 | 1253 |
1237 const SessionDescriptionInterface* PeerConnection::remote_description() const { | 1254 const SessionDescriptionInterface* PeerConnection::remote_description() const { |
1238 return session_->remote_description(); | 1255 return session_->remote_description(); |
1239 } | 1256 } |
1240 | 1257 |
1241 void PeerConnection::Close() { | 1258 void PeerConnection::Close() { |
1242 TRACE_EVENT0("webrtc", "PeerConnection::Close"); | 1259 TRACE_EVENT0("webrtc", "PeerConnection::Close"); |
1243 // Update stats here so that we have the most recent stats for tracks and | 1260 // Update stats here so that we have the most recent stats for tracks and |
1244 // streams before the channels are closed. | 1261 // streams before the channels are closed. |
1245 stats_->UpdateStats(kStatsOutputLevelStandard); | 1262 stats_->UpdateStats(kStatsOutputLevelStandard); |
1246 | |
Zhi Huang
2016/06/22 22:01:09
I will add it back before submitting.
| |
1247 session_->Close(); | 1263 session_->Close(); |
1248 } | 1264 } |
1249 | 1265 |
1250 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, | 1266 void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/, |
1251 WebRtcSession::State state) { | 1267 WebRtcSession::State state) { |
1252 switch (state) { | 1268 switch (state) { |
1253 case WebRtcSession::STATE_INIT: | 1269 case WebRtcSession::STATE_INIT: |
1254 ChangeSignalingState(PeerConnectionInterface::kStable); | 1270 ChangeSignalingState(PeerConnectionInterface::kStable); |
1255 break; | 1271 break; |
1256 case WebRtcSession::STATE_SENTOFFER: | 1272 case WebRtcSession::STATE_SENTOFFER: |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1379 RTC_DCHECK(signaling_thread()->IsCurrent()); | 1395 RTC_DCHECK(signaling_thread()->IsCurrent()); |
1380 if (IsClosed()) { | 1396 if (IsClosed()) { |
1381 return; | 1397 return; |
1382 } | 1398 } |
1383 ice_gathering_state_ = new_state; | 1399 ice_gathering_state_ = new_state; |
1384 observer_->OnIceGatheringChange(ice_gathering_state_); | 1400 observer_->OnIceGatheringChange(ice_gathering_state_); |
1385 } | 1401 } |
1386 | 1402 |
1387 void PeerConnection::OnIceCandidate(const IceCandidateInterface* candidate) { | 1403 void PeerConnection::OnIceCandidate(const IceCandidateInterface* candidate) { |
1388 RTC_DCHECK(signaling_thread()->IsCurrent()); | 1404 RTC_DCHECK(signaling_thread()->IsCurrent()); |
1405 if (IsClosed()) { | |
1406 return; | |
1407 } | |
1389 observer_->OnIceCandidate(candidate); | 1408 observer_->OnIceCandidate(candidate); |
1390 } | 1409 } |
1391 | 1410 |
1392 void PeerConnection::OnIceCandidatesRemoved( | 1411 void PeerConnection::OnIceCandidatesRemoved( |
1393 const std::vector<cricket::Candidate>& candidates) { | 1412 const std::vector<cricket::Candidate>& candidates) { |
1394 RTC_DCHECK(signaling_thread()->IsCurrent()); | 1413 RTC_DCHECK(signaling_thread()->IsCurrent()); |
1414 if (IsClosed()) { | |
1415 return; | |
1416 } | |
1395 observer_->OnIceCandidatesRemoved(candidates); | 1417 observer_->OnIceCandidatesRemoved(candidates); |
1396 } | 1418 } |
1397 | 1419 |
1398 void PeerConnection::OnIceConnectionReceivingChange(bool receiving) { | 1420 void PeerConnection::OnIceConnectionReceivingChange(bool receiving) { |
1399 RTC_DCHECK(signaling_thread()->IsCurrent()); | 1421 RTC_DCHECK(signaling_thread()->IsCurrent()); |
1422 if (IsClosed()) { | |
1423 return; | |
1424 } | |
1400 observer_->OnIceConnectionReceivingChange(receiving); | 1425 observer_->OnIceConnectionReceivingChange(receiving); |
1401 } | 1426 } |
1402 | 1427 |
1403 void PeerConnection::ChangeSignalingState( | 1428 void PeerConnection::ChangeSignalingState( |
1404 PeerConnectionInterface::SignalingState signaling_state) { | 1429 PeerConnectionInterface::SignalingState signaling_state) { |
1405 signaling_state_ = signaling_state; | 1430 signaling_state_ = signaling_state; |
1406 if (signaling_state == kClosed) { | 1431 if (signaling_state == kClosed) { |
1407 ice_connection_state_ = kIceConnectionClosed; | 1432 ice_connection_state_ = kIceConnectionClosed; |
1408 observer_->OnIceConnectionChange(ice_connection_state_); | 1433 observer_->OnIceConnectionChange(ice_connection_state_); |
1409 if (ice_gathering_state_ != kIceGatheringComplete) { | 1434 if (ice_gathering_state_ != kIceGatheringComplete) { |
1410 ice_gathering_state_ = kIceGatheringComplete; | 1435 ice_gathering_state_ = kIceGatheringComplete; |
1411 observer_->OnIceGatheringChange(ice_gathering_state_); | 1436 observer_->OnIceGatheringChange(ice_gathering_state_); |
1412 } | 1437 } |
1413 } | 1438 } |
1414 observer_->OnSignalingChange(signaling_state_); | 1439 observer_->OnSignalingChange(signaling_state_); |
1415 } | 1440 } |
1416 | 1441 |
1417 void PeerConnection::OnAudioTrackAdded(AudioTrackInterface* track, | 1442 void PeerConnection::OnAudioTrackAdded(AudioTrackInterface* track, |
1418 MediaStreamInterface* stream) { | 1443 MediaStreamInterface* stream) { |
1444 if (IsClosed()) { | |
1445 return; | |
1446 } | |
1419 auto sender = FindSenderForTrack(track); | 1447 auto sender = FindSenderForTrack(track); |
1420 if (sender != senders_.end()) { | 1448 if (sender != senders_.end()) { |
1421 // We already have a sender for this track, so just change the stream_id | 1449 // We already have a sender for this track, so just change the stream_id |
1422 // so that it's correct in the next call to CreateOffer. | 1450 // so that it's correct in the next call to CreateOffer. |
1423 (*sender)->internal()->set_stream_id(stream->label()); | 1451 (*sender)->internal()->set_stream_id(stream->label()); |
1424 return; | 1452 return; |
1425 } | 1453 } |
1426 | 1454 |
1427 // Normal case; we've never seen this track before. | 1455 // Normal case; we've never seen this track before. |
1428 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = | 1456 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = |
(...skipping 11 matching lines...) Expand all Loading... | |
1440 FindTrackInfo(local_audio_tracks_, stream->label(), track->id()); | 1468 FindTrackInfo(local_audio_tracks_, stream->label(), track->id()); |
1441 if (track_info) { | 1469 if (track_info) { |
1442 new_sender->internal()->SetSsrc(track_info->ssrc); | 1470 new_sender->internal()->SetSsrc(track_info->ssrc); |
1443 } | 1471 } |
1444 } | 1472 } |
1445 | 1473 |
1446 // TODO(deadbeef): Don't destroy RtpSenders here; they should be kept around | 1474 // TODO(deadbeef): Don't destroy RtpSenders here; they should be kept around |
1447 // indefinitely, when we have unified plan SDP. | 1475 // indefinitely, when we have unified plan SDP. |
1448 void PeerConnection::OnAudioTrackRemoved(AudioTrackInterface* track, | 1476 void PeerConnection::OnAudioTrackRemoved(AudioTrackInterface* track, |
1449 MediaStreamInterface* stream) { | 1477 MediaStreamInterface* stream) { |
1478 if (IsClosed()) { | |
1479 return; | |
1480 } | |
1450 auto sender = FindSenderForTrack(track); | 1481 auto sender = FindSenderForTrack(track); |
1451 if (sender == senders_.end()) { | 1482 if (sender == senders_.end()) { |
1452 LOG(LS_WARNING) << "RtpSender for track with id " << track->id() | 1483 LOG(LS_WARNING) << "RtpSender for track with id " << track->id() |
1453 << " doesn't exist."; | 1484 << " doesn't exist."; |
1454 return; | 1485 return; |
1455 } | 1486 } |
1456 (*sender)->internal()->Stop(); | 1487 (*sender)->internal()->Stop(); |
1457 senders_.erase(sender); | 1488 senders_.erase(sender); |
1458 } | 1489 } |
1459 | 1490 |
1460 void PeerConnection::OnVideoTrackAdded(VideoTrackInterface* track, | 1491 void PeerConnection::OnVideoTrackAdded(VideoTrackInterface* track, |
1461 MediaStreamInterface* stream) { | 1492 MediaStreamInterface* stream) { |
1493 if (IsClosed()) { | |
1494 return; | |
1495 } | |
1462 auto sender = FindSenderForTrack(track); | 1496 auto sender = FindSenderForTrack(track); |
1463 if (sender != senders_.end()) { | 1497 if (sender != senders_.end()) { |
1464 // We already have a sender for this track, so just change the stream_id | 1498 // We already have a sender for this track, so just change the stream_id |
1465 // so that it's correct in the next call to CreateOffer. | 1499 // so that it's correct in the next call to CreateOffer. |
1466 (*sender)->internal()->set_stream_id(stream->label()); | 1500 (*sender)->internal()->set_stream_id(stream->label()); |
1467 return; | 1501 return; |
1468 } | 1502 } |
1469 | 1503 |
1470 // Normal case; we've never seen this track before. | 1504 // Normal case; we've never seen this track before. |
1471 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = | 1505 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = |
1472 RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 1506 RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
1473 signaling_thread(), | 1507 signaling_thread(), |
1474 new VideoRtpSender(track, stream->label(), session_.get())); | 1508 new VideoRtpSender(track, stream->label(), session_.get())); |
1475 senders_.push_back(new_sender); | 1509 senders_.push_back(new_sender); |
1476 const TrackInfo* track_info = | 1510 const TrackInfo* track_info = |
1477 FindTrackInfo(local_video_tracks_, stream->label(), track->id()); | 1511 FindTrackInfo(local_video_tracks_, stream->label(), track->id()); |
1478 if (track_info) { | 1512 if (track_info) { |
1479 new_sender->internal()->SetSsrc(track_info->ssrc); | 1513 new_sender->internal()->SetSsrc(track_info->ssrc); |
1480 } | 1514 } |
1481 } | 1515 } |
1482 | 1516 |
1483 void PeerConnection::OnVideoTrackRemoved(VideoTrackInterface* track, | 1517 void PeerConnection::OnVideoTrackRemoved(VideoTrackInterface* track, |
1484 MediaStreamInterface* stream) { | 1518 MediaStreamInterface* stream) { |
1519 if (IsClosed()) { | |
1520 return; | |
1521 } | |
1485 auto sender = FindSenderForTrack(track); | 1522 auto sender = FindSenderForTrack(track); |
1486 if (sender == senders_.end()) { | 1523 if (sender == senders_.end()) { |
1487 LOG(LS_WARNING) << "RtpSender for track with id " << track->id() | 1524 LOG(LS_WARNING) << "RtpSender for track with id " << track->id() |
1488 << " doesn't exist."; | 1525 << " doesn't exist."; |
1489 return; | 1526 return; |
1490 } | 1527 } |
1491 (*sender)->internal()->Stop(); | 1528 (*sender)->internal()->Stop(); |
1492 senders_.erase(sender); | 1529 senders_.erase(sender); |
1493 } | 1530 } |
1494 | 1531 |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2187 port_allocator_->set_candidate_filter( | 2224 port_allocator_->set_candidate_filter( |
2188 ConvertIceTransportTypeToCandidateFilter(configuration.type)); | 2225 ConvertIceTransportTypeToCandidateFilter(configuration.type)); |
2189 // Call this last since it may create pooled allocator sessions using the | 2226 // Call this last since it may create pooled allocator sessions using the |
2190 // candidate filter set above. | 2227 // candidate filter set above. |
2191 port_allocator_->SetConfiguration(stun_servers, turn_servers, | 2228 port_allocator_->SetConfiguration(stun_servers, turn_servers, |
2192 configuration.ice_candidate_pool_size); | 2229 configuration.ice_candidate_pool_size); |
2193 return true; | 2230 return true; |
2194 } | 2231 } |
2195 | 2232 |
2196 } // namespace webrtc | 2233 } // namespace webrtc |
OLD | NEW |