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