| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 case PeerConnectionInterface::kNoHost: | 389 case PeerConnectionInterface::kNoHost: |
| 390 return (cricket::CF_ALL & ~cricket::CF_HOST); | 390 return (cricket::CF_ALL & ~cricket::CF_HOST); |
| 391 case PeerConnectionInterface::kAll: | 391 case PeerConnectionInterface::kAll: |
| 392 return cricket::CF_ALL; | 392 return cricket::CF_ALL; |
| 393 default: | 393 default: |
| 394 ASSERT(false); | 394 ASSERT(false); |
| 395 } | 395 } |
| 396 return cricket::CF_NONE; | 396 return cricket::CF_NONE; |
| 397 } | 397 } |
| 398 | 398 |
| 399 // Helper method to set a voice/video channel on all applicable senders | |
| 400 // and receivers when one is created/destroyed by WebRtcSession. | |
| 401 // | |
| 402 // Used by On(Voice|Video)Channel(Created|Destroyed) | |
| 403 template <class SENDER, | |
| 404 class RECEIVER, | |
| 405 class CHANNEL, | |
| 406 class SENDERS, | |
| 407 class RECEIVERS> | |
| 408 void SetChannelOnSendersAndReceivers(CHANNEL* channel, | |
| 409 SENDERS& senders, | |
| 410 RECEIVERS& receivers, | |
| 411 cricket::MediaType media_type) { | |
| 412 for (auto& sender : senders) { | |
| 413 if (sender->media_type() == media_type) { | |
| 414 static_cast<SENDER*>(sender->internal())->SetChannel(channel); | |
| 415 } | |
| 416 } | |
| 417 for (auto& receiver : receivers) { | |
| 418 if (receiver->media_type() == media_type) { | |
| 419 if (!channel) { | |
| 420 receiver->internal()->Stop(); | |
| 421 } | |
| 422 static_cast<RECEIVER*>(receiver->internal())->SetChannel(channel); | |
| 423 } | |
| 424 } | |
| 425 } | |
| 426 | |
| 427 } // namespace | 399 } // namespace |
| 428 | 400 |
| 429 namespace webrtc { | 401 namespace webrtc { |
| 430 | 402 |
| 431 // Generate a RTCP CNAME when a PeerConnection is created. | 403 // Generate a RTCP CNAME when a PeerConnection is created. |
| 432 std::string GenerateRtcpCname() { | 404 std::string GenerateRtcpCname() { |
| 433 std::string cname; | 405 std::string cname; |
| 434 if (!rtc::CreateRandomString(kRtcpCnameLength, &cname)) { | 406 if (!rtc::CreateRandomString(kRtcpCnameLength, &cname)) { |
| 435 LOG(LS_ERROR) << "Failed to generate CNAME."; | 407 LOG(LS_ERROR) << "Failed to generate CNAME."; |
| 436 RTC_DCHECK(false); | 408 RTC_DCHECK(false); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // Initialize the WebRtcSession. It creates transport channels etc. | 601 // Initialize the WebRtcSession. It creates transport channels etc. |
| 630 if (!session_->Initialize(factory_->options(), std::move(cert_generator), | 602 if (!session_->Initialize(factory_->options(), std::move(cert_generator), |
| 631 configuration)) { | 603 configuration)) { |
| 632 return false; | 604 return false; |
| 633 } | 605 } |
| 634 | 606 |
| 635 // Register PeerConnection as receiver of local ice candidates. | 607 // Register PeerConnection as receiver of local ice candidates. |
| 636 // All the callbacks will be posted to the application from PeerConnection. | 608 // All the callbacks will be posted to the application from PeerConnection. |
| 637 session_->RegisterIceObserver(this); | 609 session_->RegisterIceObserver(this); |
| 638 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange); | 610 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange); |
| 639 session_->SignalVoiceChannelCreated.connect( | |
| 640 this, &PeerConnection::OnVoiceChannelCreated); | |
| 641 session_->SignalVoiceChannelDestroyed.connect( | 611 session_->SignalVoiceChannelDestroyed.connect( |
| 642 this, &PeerConnection::OnVoiceChannelDestroyed); | 612 this, &PeerConnection::OnVoiceChannelDestroyed); |
| 643 session_->SignalVideoChannelCreated.connect( | |
| 644 this, &PeerConnection::OnVideoChannelCreated); | |
| 645 session_->SignalVideoChannelDestroyed.connect( | 613 session_->SignalVideoChannelDestroyed.connect( |
| 646 this, &PeerConnection::OnVideoChannelDestroyed); | 614 this, &PeerConnection::OnVideoChannelDestroyed); |
| 647 session_->SignalDataChannelCreated.connect( | 615 session_->SignalDataChannelCreated.connect( |
| 648 this, &PeerConnection::OnDataChannelCreated); | 616 this, &PeerConnection::OnDataChannelCreated); |
| 649 session_->SignalDataChannelDestroyed.connect( | 617 session_->SignalDataChannelDestroyed.connect( |
| 650 this, &PeerConnection::OnDataChannelDestroyed); | 618 this, &PeerConnection::OnDataChannelDestroyed); |
| 651 session_->SignalDataChannelOpenMessage.connect( | 619 session_->SignalDataChannelOpenMessage.connect( |
| 652 this, &PeerConnection::OnDataChannelOpenMessage); | 620 this, &PeerConnection::OnDataChannelOpenMessage); |
| 653 return true; | 621 return true; |
| 654 } | 622 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 LOG(LS_ERROR) << "Sender for track " << track->id() << " already exists."; | 706 LOG(LS_ERROR) << "Sender for track " << track->id() << " already exists."; |
| 739 return nullptr; | 707 return nullptr; |
| 740 } | 708 } |
| 741 | 709 |
| 742 // TODO(deadbeef): Support adding a track to multiple streams. | 710 // TODO(deadbeef): Support adding a track to multiple streams. |
| 743 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender; | 711 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender; |
| 744 if (track->kind() == MediaStreamTrackInterface::kAudioKind) { | 712 if (track->kind() == MediaStreamTrackInterface::kAudioKind) { |
| 745 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 713 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
| 746 signaling_thread(), | 714 signaling_thread(), |
| 747 new AudioRtpSender(static_cast<AudioTrackInterface*>(track), | 715 new AudioRtpSender(static_cast<AudioTrackInterface*>(track), |
| 748 session_->voice_channel(), stats_.get())); | 716 session_.get(), stats_.get())); |
| 749 if (!streams.empty()) { | 717 if (!streams.empty()) { |
| 750 new_sender->internal()->set_stream_id(streams[0]->label()); | 718 new_sender->internal()->set_stream_id(streams[0]->label()); |
| 751 } | 719 } |
| 752 const TrackInfo* track_info = FindTrackInfo( | 720 const TrackInfo* track_info = FindTrackInfo( |
| 753 local_audio_tracks_, new_sender->internal()->stream_id(), track->id()); | 721 local_audio_tracks_, new_sender->internal()->stream_id(), track->id()); |
| 754 if (track_info) { | 722 if (track_info) { |
| 755 new_sender->internal()->SetSsrc(track_info->ssrc); | 723 new_sender->internal()->SetSsrc(track_info->ssrc); |
| 756 } | 724 } |
| 757 } else if (track->kind() == MediaStreamTrackInterface::kVideoKind) { | 725 } else if (track->kind() == MediaStreamTrackInterface::kVideoKind) { |
| 758 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 726 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
| 759 signaling_thread(), | 727 signaling_thread(), |
| 760 new VideoRtpSender(static_cast<VideoTrackInterface*>(track), | 728 new VideoRtpSender(static_cast<VideoTrackInterface*>(track), |
| 761 session_->video_channel())); | 729 session_.get())); |
| 762 if (!streams.empty()) { | 730 if (!streams.empty()) { |
| 763 new_sender->internal()->set_stream_id(streams[0]->label()); | 731 new_sender->internal()->set_stream_id(streams[0]->label()); |
| 764 } | 732 } |
| 765 const TrackInfo* track_info = FindTrackInfo( | 733 const TrackInfo* track_info = FindTrackInfo( |
| 766 local_video_tracks_, new_sender->internal()->stream_id(), track->id()); | 734 local_video_tracks_, new_sender->internal()->stream_id(), track->id()); |
| 767 if (track_info) { | 735 if (track_info) { |
| 768 new_sender->internal()->SetSsrc(track_info->ssrc); | 736 new_sender->internal()->SetSsrc(track_info->ssrc); |
| 769 } | 737 } |
| 770 } else { | 738 } else { |
| 771 LOG(LS_ERROR) << "CreateSender called with invalid kind: " << track->kind(); | 739 LOG(LS_ERROR) << "CreateSender called with invalid kind: " << track->kind(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 return DtmfSenderProxy::Create(signaling_thread(), sender.get()); | 784 return DtmfSenderProxy::Create(signaling_thread(), sender.get()); |
| 817 } | 785 } |
| 818 | 786 |
| 819 rtc::scoped_refptr<RtpSenderInterface> PeerConnection::CreateSender( | 787 rtc::scoped_refptr<RtpSenderInterface> PeerConnection::CreateSender( |
| 820 const std::string& kind, | 788 const std::string& kind, |
| 821 const std::string& stream_id) { | 789 const std::string& stream_id) { |
| 822 TRACE_EVENT0("webrtc", "PeerConnection::CreateSender"); | 790 TRACE_EVENT0("webrtc", "PeerConnection::CreateSender"); |
| 823 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender; | 791 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender; |
| 824 if (kind == MediaStreamTrackInterface::kAudioKind) { | 792 if (kind == MediaStreamTrackInterface::kAudioKind) { |
| 825 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 793 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
| 826 signaling_thread(), | 794 signaling_thread(), new AudioRtpSender(session_.get(), stats_.get())); |
| 827 new AudioRtpSender(session_->voice_channel(), stats_.get())); | |
| 828 } else if (kind == MediaStreamTrackInterface::kVideoKind) { | 795 } else if (kind == MediaStreamTrackInterface::kVideoKind) { |
| 829 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 796 new_sender = RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
| 830 signaling_thread(), new VideoRtpSender(session_->video_channel())); | 797 signaling_thread(), new VideoRtpSender(session_.get())); |
| 831 } else { | 798 } else { |
| 832 LOG(LS_ERROR) << "CreateSender called with invalid kind: " << kind; | 799 LOG(LS_ERROR) << "CreateSender called with invalid kind: " << kind; |
| 833 return new_sender; | 800 return new_sender; |
| 834 } | 801 } |
| 835 if (!stream_id.empty()) { | 802 if (!stream_id.empty()) { |
| 836 new_sender->internal()->set_stream_id(stream_id); | 803 new_sender->internal()->set_stream_id(stream_id); |
| 837 } | 804 } |
| 838 senders_.push_back(new_sender); | 805 senders_.push_back(new_sender); |
| 839 return new_sender; | 806 return new_sender; |
| 840 } | 807 } |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 RTC_DCHECK(false && "Not implemented"); | 1315 RTC_DCHECK(false && "Not implemented"); |
| 1349 break; | 1316 break; |
| 1350 } | 1317 } |
| 1351 } | 1318 } |
| 1352 | 1319 |
| 1353 void PeerConnection::CreateAudioReceiver(MediaStreamInterface* stream, | 1320 void PeerConnection::CreateAudioReceiver(MediaStreamInterface* stream, |
| 1354 const std::string& track_id, | 1321 const std::string& track_id, |
| 1355 uint32_t ssrc) { | 1322 uint32_t ssrc) { |
| 1356 receivers_.push_back( | 1323 receivers_.push_back( |
| 1357 RtpReceiverProxyWithInternal<RtpReceiverInternal>::Create( | 1324 RtpReceiverProxyWithInternal<RtpReceiverInternal>::Create( |
| 1358 signaling_thread(), new AudioRtpReceiver(stream, track_id, ssrc, | 1325 signaling_thread(), |
| 1359 session_->voice_channel()))); | 1326 new AudioRtpReceiver(stream, track_id, ssrc, session_.get()))); |
| 1360 } | 1327 } |
| 1361 | 1328 |
| 1362 void PeerConnection::CreateVideoReceiver(MediaStreamInterface* stream, | 1329 void PeerConnection::CreateVideoReceiver(MediaStreamInterface* stream, |
| 1363 const std::string& track_id, | 1330 const std::string& track_id, |
| 1364 uint32_t ssrc) { | 1331 uint32_t ssrc) { |
| 1365 receivers_.push_back( | 1332 receivers_.push_back( |
| 1366 RtpReceiverProxyWithInternal<RtpReceiverInternal>::Create( | 1333 RtpReceiverProxyWithInternal<RtpReceiverInternal>::Create( |
| 1367 signaling_thread(), | 1334 signaling_thread(), |
| 1368 new VideoRtpReceiver(stream, track_id, factory_->worker_thread(), | 1335 new VideoRtpReceiver(stream, track_id, factory_->worker_thread(), |
| 1369 ssrc, session_->video_channel()))); | 1336 ssrc, session_.get()))); |
| 1370 } | 1337 } |
| 1371 | 1338 |
| 1372 // TODO(deadbeef): Keep RtpReceivers around even if track goes away in remote | 1339 // TODO(deadbeef): Keep RtpReceivers around even if track goes away in remote |
| 1373 // description. | 1340 // description. |
| 1374 void PeerConnection::DestroyReceiver(const std::string& track_id) { | 1341 void PeerConnection::DestroyReceiver(const std::string& track_id) { |
| 1375 auto it = FindReceiverForTrack(track_id); | 1342 auto it = FindReceiverForTrack(track_id); |
| 1376 if (it == receivers_.end()) { | 1343 if (it == receivers_.end()) { |
| 1377 LOG(LS_WARNING) << "RtpReceiver for track with id " << track_id | 1344 LOG(LS_WARNING) << "RtpReceiver for track with id " << track_id |
| 1378 << " doesn't exist."; | 1345 << " doesn't exist."; |
| 1379 } else { | 1346 } else { |
| 1380 (*it)->internal()->Stop(); | 1347 (*it)->internal()->Stop(); |
| 1381 receivers_.erase(it); | 1348 receivers_.erase(it); |
| 1382 } | 1349 } |
| 1383 } | 1350 } |
| 1384 | 1351 |
| 1352 void PeerConnection::StopReceivers(cricket::MediaType media_type) { |
| 1353 TrackInfos* current_tracks = GetRemoteTracks(media_type); |
| 1354 for (const auto& track_info : *current_tracks) { |
| 1355 auto it = FindReceiverForTrack(track_info.track_id); |
| 1356 if (it == receivers_.end()) { |
| 1357 LOG(LS_WARNING) << "RtpReceiver for track with id " << track_info.track_id |
| 1358 << " doesn't exist."; |
| 1359 } else { |
| 1360 (*it)->internal()->Stop(); |
| 1361 } |
| 1362 } |
| 1363 } |
| 1364 |
| 1385 void PeerConnection::OnIceConnectionChange( | 1365 void PeerConnection::OnIceConnectionChange( |
| 1386 PeerConnectionInterface::IceConnectionState new_state) { | 1366 PeerConnectionInterface::IceConnectionState new_state) { |
| 1387 RTC_DCHECK(signaling_thread()->IsCurrent()); | 1367 RTC_DCHECK(signaling_thread()->IsCurrent()); |
| 1388 // After transitioning to "closed", ignore any additional states from | 1368 // After transitioning to "closed", ignore any additional states from |
| 1389 // WebRtcSession (such as "disconnected"). | 1369 // WebRtcSession (such as "disconnected"). |
| 1390 if (IsClosed()) { | 1370 if (IsClosed()) { |
| 1391 return; | 1371 return; |
| 1392 } | 1372 } |
| 1393 ice_connection_state_ = new_state; | 1373 ice_connection_state_ = new_state; |
| 1394 observer_->OnIceConnectionChange(ice_connection_state_); | 1374 observer_->OnIceConnectionChange(ice_connection_state_); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 if (sender != senders_.end()) { | 1420 if (sender != senders_.end()) { |
| 1441 // We already have a sender for this track, so just change the stream_id | 1421 // We already have a sender for this track, so just change the stream_id |
| 1442 // so that it's correct in the next call to CreateOffer. | 1422 // so that it's correct in the next call to CreateOffer. |
| 1443 (*sender)->internal()->set_stream_id(stream->label()); | 1423 (*sender)->internal()->set_stream_id(stream->label()); |
| 1444 return; | 1424 return; |
| 1445 } | 1425 } |
| 1446 | 1426 |
| 1447 // Normal case; we've never seen this track before. | 1427 // Normal case; we've never seen this track before. |
| 1448 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = | 1428 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = |
| 1449 RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 1429 RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
| 1450 signaling_thread(), | 1430 signaling_thread(), new AudioRtpSender(track, stream->label(), |
| 1451 new AudioRtpSender(track, stream->label(), session_->voice_channel(), | 1431 session_.get(), stats_.get())); |
| 1452 stats_.get())); | |
| 1453 senders_.push_back(new_sender); | 1432 senders_.push_back(new_sender); |
| 1454 // If the sender has already been configured in SDP, we call SetSsrc, | 1433 // If the sender has already been configured in SDP, we call SetSsrc, |
| 1455 // which will connect the sender to the underlying transport. This can | 1434 // which will connect the sender to the underlying transport. This can |
| 1456 // occur if a local session description that contains the ID of the sender | 1435 // occur if a local session description that contains the ID of the sender |
| 1457 // is set before AddStream is called. It can also occur if the local | 1436 // is set before AddStream is called. It can also occur if the local |
| 1458 // session description is not changed and RemoveStream is called, and | 1437 // session description is not changed and RemoveStream is called, and |
| 1459 // later AddStream is called again with the same stream. | 1438 // later AddStream is called again with the same stream. |
| 1460 const TrackInfo* track_info = | 1439 const TrackInfo* track_info = |
| 1461 FindTrackInfo(local_audio_tracks_, stream->label(), track->id()); | 1440 FindTrackInfo(local_audio_tracks_, stream->label(), track->id()); |
| 1462 if (track_info) { | 1441 if (track_info) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1484 if (sender != senders_.end()) { | 1463 if (sender != senders_.end()) { |
| 1485 // We already have a sender for this track, so just change the stream_id | 1464 // We already have a sender for this track, so just change the stream_id |
| 1486 // so that it's correct in the next call to CreateOffer. | 1465 // so that it's correct in the next call to CreateOffer. |
| 1487 (*sender)->internal()->set_stream_id(stream->label()); | 1466 (*sender)->internal()->set_stream_id(stream->label()); |
| 1488 return; | 1467 return; |
| 1489 } | 1468 } |
| 1490 | 1469 |
| 1491 // Normal case; we've never seen this track before. | 1470 // Normal case; we've never seen this track before. |
| 1492 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = | 1471 rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> new_sender = |
| 1493 RtpSenderProxyWithInternal<RtpSenderInternal>::Create( | 1472 RtpSenderProxyWithInternal<RtpSenderInternal>::Create( |
| 1494 signaling_thread(), new VideoRtpSender(track, stream->label(), | 1473 signaling_thread(), |
| 1495 session_->video_channel())); | 1474 new VideoRtpSender(track, stream->label(), session_.get())); |
| 1496 senders_.push_back(new_sender); | 1475 senders_.push_back(new_sender); |
| 1497 const TrackInfo* track_info = | 1476 const TrackInfo* track_info = |
| 1498 FindTrackInfo(local_video_tracks_, stream->label(), track->id()); | 1477 FindTrackInfo(local_video_tracks_, stream->label(), track->id()); |
| 1499 if (track_info) { | 1478 if (track_info) { |
| 1500 new_sender->internal()->SetSsrc(track_info->ssrc); | 1479 new_sender->internal()->SetSsrc(track_info->ssrc); |
| 1501 } | 1480 } |
| 1502 } | 1481 } |
| 1503 | 1482 |
| 1504 void PeerConnection::OnVideoTrackRemoved(VideoTrackInterface* track, | 1483 void PeerConnection::OnVideoTrackRemoved(VideoTrackInterface* track, |
| 1505 MediaStreamInterface* stream) { | 1484 MediaStreamInterface* stream) { |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 // we can't free it directly here; we need to free it asynchronously. | 2006 // we can't free it directly here; we need to free it asynchronously. |
| 2028 sctp_data_channels_to_free_.push_back(*it); | 2007 sctp_data_channels_to_free_.push_back(*it); |
| 2029 sctp_data_channels_.erase(it); | 2008 sctp_data_channels_.erase(it); |
| 2030 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_FREE_DATACHANNELS, | 2009 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_FREE_DATACHANNELS, |
| 2031 nullptr); | 2010 nullptr); |
| 2032 return; | 2011 return; |
| 2033 } | 2012 } |
| 2034 } | 2013 } |
| 2035 } | 2014 } |
| 2036 | 2015 |
| 2037 void PeerConnection::OnVoiceChannelCreated() { | |
| 2038 SetChannelOnSendersAndReceivers<AudioRtpSender, AudioRtpReceiver>( | |
| 2039 session_->voice_channel(), senders_, receivers_, | |
| 2040 cricket::MEDIA_TYPE_AUDIO); | |
| 2041 } | |
| 2042 | |
| 2043 void PeerConnection::OnVoiceChannelDestroyed() { | 2016 void PeerConnection::OnVoiceChannelDestroyed() { |
| 2044 SetChannelOnSendersAndReceivers<AudioRtpSender, AudioRtpReceiver, | 2017 StopReceivers(cricket::MEDIA_TYPE_AUDIO); |
| 2045 cricket::VoiceChannel>( | |
| 2046 nullptr, senders_, receivers_, cricket::MEDIA_TYPE_AUDIO); | |
| 2047 } | |
| 2048 | |
| 2049 void PeerConnection::OnVideoChannelCreated() { | |
| 2050 SetChannelOnSendersAndReceivers<VideoRtpSender, VideoRtpReceiver>( | |
| 2051 session_->video_channel(), senders_, receivers_, | |
| 2052 cricket::MEDIA_TYPE_VIDEO); | |
| 2053 } | 2018 } |
| 2054 | 2019 |
| 2055 void PeerConnection::OnVideoChannelDestroyed() { | 2020 void PeerConnection::OnVideoChannelDestroyed() { |
| 2056 SetChannelOnSendersAndReceivers<VideoRtpSender, VideoRtpReceiver, | 2021 StopReceivers(cricket::MEDIA_TYPE_VIDEO); |
| 2057 cricket::VideoChannel>( | |
| 2058 nullptr, senders_, receivers_, cricket::MEDIA_TYPE_VIDEO); | |
| 2059 } | 2022 } |
| 2060 | 2023 |
| 2061 void PeerConnection::OnDataChannelCreated() { | 2024 void PeerConnection::OnDataChannelCreated() { |
| 2062 for (const auto& channel : sctp_data_channels_) { | 2025 for (const auto& channel : sctp_data_channels_) { |
| 2063 channel->OnTransportChannelCreated(); | 2026 channel->OnTransportChannelCreated(); |
| 2064 } | 2027 } |
| 2065 } | 2028 } |
| 2066 | 2029 |
| 2067 void PeerConnection::OnDataChannelDestroyed() { | 2030 void PeerConnection::OnDataChannelDestroyed() { |
| 2068 // Use a temporary copy of the RTP/SCTP DataChannel list because the | 2031 // Use a temporary copy of the RTP/SCTP DataChannel list because the |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2224 port_allocator_->set_candidate_filter( | 2187 port_allocator_->set_candidate_filter( |
| 2225 ConvertIceTransportTypeToCandidateFilter(configuration.type)); | 2188 ConvertIceTransportTypeToCandidateFilter(configuration.type)); |
| 2226 // Call this last since it may create pooled allocator sessions using the | 2189 // Call this last since it may create pooled allocator sessions using the |
| 2227 // candidate filter set above. | 2190 // candidate filter set above. |
| 2228 port_allocator_->SetConfiguration(stun_servers, turn_servers, | 2191 port_allocator_->SetConfiguration(stun_servers, turn_servers, |
| 2229 configuration.ice_candidate_pool_size); | 2192 configuration.ice_candidate_pool_size); |
| 2230 return true; | 2193 return true; |
| 2231 } | 2194 } |
| 2232 | 2195 |
| 2233 } // namespace webrtc | 2196 } // namespace webrtc |
| OLD | NEW |