Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: webrtc/api/webrtcsession.cc

Issue 2620303003: Replace ASSERT by RTC_DCHECK in all non-test code. (Closed)
Patch Set: Address final nits. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/webrtcsdp.cc ('k') | webrtc/api/webrtcsessiondescriptionfactory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 return false; 251 return false;
252 } 252 }
253 253
254 *ssrc = stream->first_ssrc(); 254 *ssrc = stream->first_ssrc();
255 return true; 255 return true;
256 } 256 }
257 257
258 static bool GetTrackIdBySsrc(const SessionDescription* session_description, 258 static bool GetTrackIdBySsrc(const SessionDescription* session_description,
259 uint32_t ssrc, 259 uint32_t ssrc,
260 std::string* track_id) { 260 std::string* track_id) {
261 ASSERT(track_id != NULL); 261 RTC_DCHECK(track_id != NULL);
262 262
263 const cricket::ContentInfo* audio_info = 263 const cricket::ContentInfo* audio_info =
264 cricket::GetFirstAudioContent(session_description); 264 cricket::GetFirstAudioContent(session_description);
265 if (audio_info) { 265 if (audio_info) {
266 const cricket::MediaContentDescription* audio_content = 266 const cricket::MediaContentDescription* audio_content =
267 static_cast<const cricket::MediaContentDescription*>( 267 static_cast<const cricket::MediaContentDescription*>(
268 audio_info->description); 268 audio_info->description);
269 269
270 const auto* found = 270 const auto* found =
271 cricket::GetStreamBySsrc(audio_content->streams(), ssrc); 271 cricket::GetStreamBySsrc(audio_content->streams(), ssrc);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 this, &WebRtcSession::OnTransportControllerGatheringState); 495 this, &WebRtcSession::OnTransportControllerGatheringState);
496 transport_controller_->SignalCandidatesGathered.connect( 496 transport_controller_->SignalCandidatesGathered.connect(
497 this, &WebRtcSession::OnTransportControllerCandidatesGathered); 497 this, &WebRtcSession::OnTransportControllerCandidatesGathered);
498 transport_controller_->SignalCandidatesRemoved.connect( 498 transport_controller_->SignalCandidatesRemoved.connect(
499 this, &WebRtcSession::OnTransportControllerCandidatesRemoved); 499 this, &WebRtcSession::OnTransportControllerCandidatesRemoved);
500 transport_controller_->SignalDtlsHandshakeError.connect( 500 transport_controller_->SignalDtlsHandshakeError.connect(
501 this, &WebRtcSession::OnTransportControllerDtlsHandshakeError); 501 this, &WebRtcSession::OnTransportControllerDtlsHandshakeError);
502 } 502 }
503 503
504 WebRtcSession::~WebRtcSession() { 504 WebRtcSession::~WebRtcSession() {
505 ASSERT(signaling_thread()->IsCurrent()); 505 RTC_DCHECK(signaling_thread()->IsCurrent());
506 // Destroy video_channel_ first since it may have a pointer to the 506 // Destroy video_channel_ first since it may have a pointer to the
507 // voice_channel_. 507 // voice_channel_.
508 if (video_channel_) { 508 if (video_channel_) {
509 SignalVideoChannelDestroyed(); 509 SignalVideoChannelDestroyed();
510 channel_manager_->DestroyVideoChannel(video_channel_.release()); 510 channel_manager_->DestroyVideoChannel(video_channel_.release());
511 } 511 }
512 if (voice_channel_) { 512 if (voice_channel_) {
513 SignalVoiceChannelDestroyed(); 513 SignalVoiceChannelDestroyed();
514 channel_manager_->DestroyVoiceChannel(voice_channel_.release()); 514 channel_manager_->DestroyVoiceChannel(voice_channel_.release());
515 } 515 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 691 }
692 692
693 void WebRtcSession::CreateAnswer( 693 void WebRtcSession::CreateAnswer(
694 CreateSessionDescriptionObserver* observer, 694 CreateSessionDescriptionObserver* observer,
695 const cricket::MediaSessionOptions& session_options) { 695 const cricket::MediaSessionOptions& session_options) {
696 webrtc_session_desc_factory_->CreateAnswer(observer, session_options); 696 webrtc_session_desc_factory_->CreateAnswer(observer, session_options);
697 } 697 }
698 698
699 bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc, 699 bool WebRtcSession::SetLocalDescription(SessionDescriptionInterface* desc,
700 std::string* err_desc) { 700 std::string* err_desc) {
701 ASSERT(signaling_thread()->IsCurrent()); 701 RTC_DCHECK(signaling_thread()->IsCurrent());
702 702
703 // Takes the ownership of |desc| regardless of the result. 703 // Takes the ownership of |desc| regardless of the result.
704 std::unique_ptr<SessionDescriptionInterface> desc_temp(desc); 704 std::unique_ptr<SessionDescriptionInterface> desc_temp(desc);
705 705
706 // Validate SDP. 706 // Validate SDP.
707 if (!ValidateSessionDescription(desc, cricket::CS_LOCAL, err_desc)) { 707 if (!ValidateSessionDescription(desc, cricket::CS_LOCAL, err_desc)) {
708 return false; 708 return false;
709 } 709 }
710 710
711 // Update the initial_offerer flag if this session is the initial_offerer. 711 // Update the initial_offerer flag if this session is the initial_offerer.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 pending_ice_restarts_.clear(); 745 pending_ice_restarts_.clear();
746 746
747 if (error() != ERROR_NONE) { 747 if (error() != ERROR_NONE) {
748 return BadLocalSdp(desc->type(), GetSessionErrorMsg(), err_desc); 748 return BadLocalSdp(desc->type(), GetSessionErrorMsg(), err_desc);
749 } 749 }
750 return true; 750 return true;
751 } 751 }
752 752
753 bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc, 753 bool WebRtcSession::SetRemoteDescription(SessionDescriptionInterface* desc,
754 std::string* err_desc) { 754 std::string* err_desc) {
755 ASSERT(signaling_thread()->IsCurrent()); 755 RTC_DCHECK(signaling_thread()->IsCurrent());
756 756
757 // Takes the ownership of |desc| regardless of the result. 757 // Takes the ownership of |desc| regardless of the result.
758 std::unique_ptr<SessionDescriptionInterface> desc_temp(desc); 758 std::unique_ptr<SessionDescriptionInterface> desc_temp(desc);
759 759
760 // Validate SDP. 760 // Validate SDP.
761 if (!ValidateSessionDescription(desc, cricket::CS_REMOTE, err_desc)) { 761 if (!ValidateSessionDescription(desc, cricket::CS_REMOTE, err_desc)) {
762 return false; 762 return false;
763 } 763 }
764 764
765 const SessionDescriptionInterface* old_remote_description = 765 const SessionDescriptionInterface* old_remote_description =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 return true; 846 return true;
847 } 847 }
848 848
849 void WebRtcSession::LogState(State old_state, State new_state) { 849 void WebRtcSession::LogState(State old_state, State new_state) {
850 LOG(LS_INFO) << "Session:" << id() 850 LOG(LS_INFO) << "Session:" << id()
851 << " Old state:" << GetStateString(old_state) 851 << " Old state:" << GetStateString(old_state)
852 << " New state:" << GetStateString(new_state); 852 << " New state:" << GetStateString(new_state);
853 } 853 }
854 854
855 void WebRtcSession::SetState(State state) { 855 void WebRtcSession::SetState(State state) {
856 ASSERT(signaling_thread_->IsCurrent()); 856 RTC_DCHECK(signaling_thread_->IsCurrent());
857 if (state != state_) { 857 if (state != state_) {
858 LogState(state_, state); 858 LogState(state_, state);
859 state_ = state; 859 state_ = state;
860 SignalState(this, state_); 860 SignalState(this, state_);
861 } 861 }
862 } 862 }
863 863
864 void WebRtcSession::SetError(Error error, const std::string& error_desc) { 864 void WebRtcSession::SetError(Error error, const std::string& error_desc) {
865 ASSERT(signaling_thread_->IsCurrent()); 865 RTC_DCHECK(signaling_thread_->IsCurrent());
866 if (error != error_) { 866 if (error != error_) {
867 error_ = error; 867 error_ = error;
868 error_desc_ = error_desc; 868 error_desc_ = error_desc;
869 } 869 }
870 } 870 }
871 871
872 bool WebRtcSession::UpdateSessionState( 872 bool WebRtcSession::UpdateSessionState(
873 Action action, cricket::ContentSource source, 873 Action action, cricket::ContentSource source,
874 std::string* err_desc) { 874 std::string* err_desc) {
875 ASSERT(signaling_thread()->IsCurrent()); 875 RTC_DCHECK(signaling_thread()->IsCurrent());
876 876
877 // If there's already a pending error then no state transition should happen. 877 // If there's already a pending error then no state transition should happen.
878 // But all call-sites should be verifying this before calling us! 878 // But all call-sites should be verifying this before calling us!
879 ASSERT(error() == ERROR_NONE); 879 RTC_DCHECK(error() == ERROR_NONE);
880 std::string td_err; 880 std::string td_err;
881 if (action == kOffer) { 881 if (action == kOffer) {
882 if (!PushdownTransportDescription(source, cricket::CA_OFFER, &td_err)) { 882 if (!PushdownTransportDescription(source, cricket::CA_OFFER, &td_err)) {
883 return BadOfferSdp(source, MakeTdErrorString(td_err), err_desc); 883 return BadOfferSdp(source, MakeTdErrorString(td_err), err_desc);
884 } 884 }
885 SetState(source == cricket::CS_LOCAL ? STATE_SENTOFFER 885 SetState(source == cricket::CS_LOCAL ? STATE_SENTOFFER
886 : STATE_RECEIVEDOFFER); 886 : STATE_RECEIVEDOFFER);
887 if (!PushdownMediaDescription(cricket::CA_OFFER, source, err_desc)) { 887 if (!PushdownMediaDescription(cricket::CA_OFFER, source, err_desc)) {
888 SetError(ERROR_CONTENT, *err_desc); 888 SetError(ERROR_CONTENT, *err_desc);
889 } 889 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 937 }
938 938
939 WebRtcSession::Action WebRtcSession::GetAction(const std::string& type) { 939 WebRtcSession::Action WebRtcSession::GetAction(const std::string& type) {
940 if (type == SessionDescriptionInterface::kOffer) { 940 if (type == SessionDescriptionInterface::kOffer) {
941 return WebRtcSession::kOffer; 941 return WebRtcSession::kOffer;
942 } else if (type == SessionDescriptionInterface::kPrAnswer) { 942 } else if (type == SessionDescriptionInterface::kPrAnswer) {
943 return WebRtcSession::kPrAnswer; 943 return WebRtcSession::kPrAnswer;
944 } else if (type == SessionDescriptionInterface::kAnswer) { 944 } else if (type == SessionDescriptionInterface::kAnswer) {
945 return WebRtcSession::kAnswer; 945 return WebRtcSession::kAnswer;
946 } 946 }
947 ASSERT(false && "unknown action type"); 947 RTC_NOTREACHED() << "unknown action type";
948 return WebRtcSession::kOffer; 948 return WebRtcSession::kOffer;
949 } 949 }
950 950
951 bool WebRtcSession::PushdownMediaDescription( 951 bool WebRtcSession::PushdownMediaDescription(
952 cricket::ContentAction action, 952 cricket::ContentAction action,
953 cricket::ContentSource source, 953 cricket::ContentSource source,
954 std::string* err) { 954 std::string* err) {
955 auto set_content = [this, action, source, err](cricket::BaseChannel* ch) { 955 auto set_content = [this, action, source, err](cricket::BaseChannel* ch) {
956 if (!ch) { 956 if (!ch) {
957 return true; 957 return true;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 track_id); 1233 track_id);
1234 } 1234 }
1235 1235
1236 std::string WebRtcSession::BadStateErrMsg(State state) { 1236 std::string WebRtcSession::BadStateErrMsg(State state) {
1237 std::ostringstream desc; 1237 std::ostringstream desc;
1238 desc << "Called in wrong state: " << GetStateString(state); 1238 desc << "Called in wrong state: " << GetStateString(state);
1239 return desc.str(); 1239 return desc.str();
1240 } 1240 }
1241 1241
1242 bool WebRtcSession::CanInsertDtmf(const std::string& track_id) { 1242 bool WebRtcSession::CanInsertDtmf(const std::string& track_id) {
1243 ASSERT(signaling_thread()->IsCurrent()); 1243 RTC_DCHECK(signaling_thread()->IsCurrent());
1244 if (!voice_channel_) { 1244 if (!voice_channel_) {
1245 LOG(LS_ERROR) << "CanInsertDtmf: No audio channel exists."; 1245 LOG(LS_ERROR) << "CanInsertDtmf: No audio channel exists.";
1246 return false; 1246 return false;
1247 } 1247 }
1248 uint32_t send_ssrc = 0; 1248 uint32_t send_ssrc = 0;
1249 // The Dtmf is negotiated per channel not ssrc, so we only check if the ssrc 1249 // The Dtmf is negotiated per channel not ssrc, so we only check if the ssrc
1250 // exists. 1250 // exists.
1251 if (!local_description() || 1251 if (!local_description() ||
1252 !GetAudioSsrcByTrackId(local_description()->description(), track_id, 1252 !GetAudioSsrcByTrackId(local_description()->description(), track_id,
1253 &send_ssrc)) { 1253 &send_ssrc)) {
1254 LOG(LS_ERROR) << "CanInsertDtmf: Track does not exist: " << track_id; 1254 LOG(LS_ERROR) << "CanInsertDtmf: Track does not exist: " << track_id;
1255 return false; 1255 return false;
1256 } 1256 }
1257 return voice_channel_->CanInsertDtmf(); 1257 return voice_channel_->CanInsertDtmf();
1258 } 1258 }
1259 1259
1260 bool WebRtcSession::InsertDtmf(const std::string& track_id, 1260 bool WebRtcSession::InsertDtmf(const std::string& track_id,
1261 int code, int duration) { 1261 int code, int duration) {
1262 ASSERT(signaling_thread()->IsCurrent()); 1262 RTC_DCHECK(signaling_thread()->IsCurrent());
1263 if (!voice_channel_) { 1263 if (!voice_channel_) {
1264 LOG(LS_ERROR) << "InsertDtmf: No audio channel exists."; 1264 LOG(LS_ERROR) << "InsertDtmf: No audio channel exists.";
1265 return false; 1265 return false;
1266 } 1266 }
1267 uint32_t send_ssrc = 0; 1267 uint32_t send_ssrc = 0;
1268 if (!VERIFY(local_description() && 1268 if (!VERIFY(local_description() &&
1269 GetAudioSsrcByTrackId(local_description()->description(), 1269 GetAudioSsrcByTrackId(local_description()->description(),
1270 track_id, &send_ssrc))) { 1270 track_id, &send_ssrc))) {
1271 LOG(LS_ERROR) << "InsertDtmf: Track does not exist: " << track_id; 1271 LOG(LS_ERROR) << "InsertDtmf: Track does not exist: " << track_id;
1272 return false; 1272 return false;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 RTC_FROM_HERE, rtc::Bind(&cricket::SctpTransportInternal::ResetStream, 1357 RTC_FROM_HERE, rtc::Bind(&cricket::SctpTransportInternal::ResetStream,
1358 sctp_transport_.get(), sid)); 1358 sctp_transport_.get(), sid));
1359 } 1359 }
1360 1360
1361 bool WebRtcSession::ReadyToSendData() const { 1361 bool WebRtcSession::ReadyToSendData() const {
1362 return (rtp_data_channel_ && rtp_data_channel_->ready_to_send_data()) || 1362 return (rtp_data_channel_ && rtp_data_channel_->ready_to_send_data()) ||
1363 sctp_ready_to_send_data_; 1363 sctp_ready_to_send_data_;
1364 } 1364 }
1365 1365
1366 std::unique_ptr<SessionStats> WebRtcSession::GetStats_s() { 1366 std::unique_ptr<SessionStats> WebRtcSession::GetStats_s() {
1367 ASSERT(signaling_thread()->IsCurrent()); 1367 RTC_DCHECK(signaling_thread()->IsCurrent());
1368 ChannelNamePairs channel_name_pairs; 1368 ChannelNamePairs channel_name_pairs;
1369 if (voice_channel()) { 1369 if (voice_channel()) {
1370 channel_name_pairs.voice = rtc::Optional<ChannelNamePair>(ChannelNamePair( 1370 channel_name_pairs.voice = rtc::Optional<ChannelNamePair>(ChannelNamePair(
1371 voice_channel()->content_name(), voice_channel()->transport_name())); 1371 voice_channel()->content_name(), voice_channel()->transport_name()));
1372 } 1372 }
1373 if (video_channel()) { 1373 if (video_channel()) {
1374 channel_name_pairs.video = rtc::Optional<ChannelNamePair>(ChannelNamePair( 1374 channel_name_pairs.video = rtc::Optional<ChannelNamePair>(ChannelNamePair(
1375 video_channel()->content_name(), video_channel()->transport_name())); 1375 video_channel()->content_name(), video_channel()->transport_name()));
1376 } 1376 }
1377 if (rtp_data_channel()) { 1377 if (rtp_data_channel()) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 } 1517 }
1518 ice_connection_receiving_ = receiving; 1518 ice_connection_receiving_ = receiving;
1519 if (ice_observer_) { 1519 if (ice_observer_) {
1520 ice_observer_->OnIceConnectionReceivingChange(receiving); 1520 ice_observer_->OnIceConnectionReceivingChange(receiving);
1521 } 1521 }
1522 } 1522 }
1523 1523
1524 void WebRtcSession::OnTransportControllerCandidatesGathered( 1524 void WebRtcSession::OnTransportControllerCandidatesGathered(
1525 const std::string& transport_name, 1525 const std::string& transport_name,
1526 const cricket::Candidates& candidates) { 1526 const cricket::Candidates& candidates) {
1527 ASSERT(signaling_thread()->IsCurrent()); 1527 RTC_DCHECK(signaling_thread()->IsCurrent());
1528 int sdp_mline_index; 1528 int sdp_mline_index;
1529 if (!GetLocalCandidateMediaIndex(transport_name, &sdp_mline_index)) { 1529 if (!GetLocalCandidateMediaIndex(transport_name, &sdp_mline_index)) {
1530 LOG(LS_ERROR) << "OnTransportControllerCandidatesGathered: content name " 1530 LOG(LS_ERROR) << "OnTransportControllerCandidatesGathered: content name "
1531 << transport_name << " not found"; 1531 << transport_name << " not found";
1532 return; 1532 return;
1533 } 1533 }
1534 1534
1535 for (cricket::Candidates::const_iterator citer = candidates.begin(); 1535 for (cricket::Candidates::const_iterator citer = candidates.begin();
1536 citer != candidates.end(); ++citer) { 1536 citer != candidates.end(); ++citer) {
1537 // Use transport_name as the candidate media id. 1537 // Use transport_name as the candidate media id.
1538 JsepIceCandidate candidate(transport_name, sdp_mline_index, *citer); 1538 JsepIceCandidate candidate(transport_name, sdp_mline_index, *citer);
1539 if (ice_observer_) { 1539 if (ice_observer_) {
1540 ice_observer_->OnIceCandidate(&candidate); 1540 ice_observer_->OnIceCandidate(&candidate);
1541 } 1541 }
1542 if (local_description()) { 1542 if (local_description()) {
1543 mutable_local_description()->AddCandidate(&candidate); 1543 mutable_local_description()->AddCandidate(&candidate);
1544 } 1544 }
1545 } 1545 }
1546 } 1546 }
1547 1547
1548 void WebRtcSession::OnTransportControllerCandidatesRemoved( 1548 void WebRtcSession::OnTransportControllerCandidatesRemoved(
1549 const std::vector<cricket::Candidate>& candidates) { 1549 const std::vector<cricket::Candidate>& candidates) {
1550 ASSERT(signaling_thread()->IsCurrent()); 1550 RTC_DCHECK(signaling_thread()->IsCurrent());
1551 // Sanity check. 1551 // Sanity check.
1552 for (const cricket::Candidate& candidate : candidates) { 1552 for (const cricket::Candidate& candidate : candidates) {
1553 if (candidate.transport_name().empty()) { 1553 if (candidate.transport_name().empty()) {
1554 LOG(LS_ERROR) << "OnTransportControllerCandidatesRemoved: " 1554 LOG(LS_ERROR) << "OnTransportControllerCandidatesRemoved: "
1555 << "empty content name in candidate " 1555 << "empty content name in candidate "
1556 << candidate.ToString(); 1556 << candidate.ToString();
1557 return; 1557 return;
1558 } 1558 }
1559 } 1559 }
1560 1560
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 rtp_data_channel_->SignalSentPacket.connect(this, 1865 rtp_data_channel_->SignalSentPacket.connect(this,
1866 &WebRtcSession::OnSentPacket_w); 1866 &WebRtcSession::OnSentPacket_w);
1867 } 1867 }
1868 1868
1869 SignalDataChannelCreated(); 1869 SignalDataChannelCreated();
1870 return true; 1870 return true;
1871 } 1871 }
1872 1872
1873 std::unique_ptr<SessionStats> WebRtcSession::GetStats_n( 1873 std::unique_ptr<SessionStats> WebRtcSession::GetStats_n(
1874 const ChannelNamePairs& channel_name_pairs) { 1874 const ChannelNamePairs& channel_name_pairs) {
1875 ASSERT(network_thread()->IsCurrent()); 1875 RTC_DCHECK(network_thread()->IsCurrent());
1876 std::unique_ptr<SessionStats> session_stats(new SessionStats()); 1876 std::unique_ptr<SessionStats> session_stats(new SessionStats());
1877 for (const auto channel_name_pair : { &channel_name_pairs.voice, 1877 for (const auto channel_name_pair : { &channel_name_pairs.voice,
1878 &channel_name_pairs.video, 1878 &channel_name_pairs.video,
1879 &channel_name_pairs.data }) { 1879 &channel_name_pairs.data }) {
1880 if (*channel_name_pair) { 1880 if (*channel_name_pair) {
1881 cricket::TransportStats transport_stats; 1881 cricket::TransportStats transport_stats;
1882 if (!transport_controller_->GetStats((*channel_name_pair)->transport_name, 1882 if (!transport_controller_->GetStats((*channel_name_pair)->transport_name,
1883 &transport_stats)) { 1883 &transport_stats)) {
1884 return nullptr; 1884 return nullptr;
1885 } 1885 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 } 1994 }
1995 1995
1996 // Returns false if bundle is enabled and rtcp_mux is disabled. 1996 // Returns false if bundle is enabled and rtcp_mux is disabled.
1997 bool WebRtcSession::ValidateBundleSettings(const SessionDescription* desc) { 1997 bool WebRtcSession::ValidateBundleSettings(const SessionDescription* desc) {
1998 bool bundle_enabled = desc->HasGroup(cricket::GROUP_TYPE_BUNDLE); 1998 bool bundle_enabled = desc->HasGroup(cricket::GROUP_TYPE_BUNDLE);
1999 if (!bundle_enabled) 1999 if (!bundle_enabled)
2000 return true; 2000 return true;
2001 2001
2002 const cricket::ContentGroup* bundle_group = 2002 const cricket::ContentGroup* bundle_group =
2003 desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE); 2003 desc->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);
2004 ASSERT(bundle_group != NULL); 2004 RTC_DCHECK(bundle_group != NULL);
2005 2005
2006 const cricket::ContentInfos& contents = desc->contents(); 2006 const cricket::ContentInfos& contents = desc->contents();
2007 for (cricket::ContentInfos::const_iterator citer = contents.begin(); 2007 for (cricket::ContentInfos::const_iterator citer = contents.begin();
2008 citer != contents.end(); ++citer) { 2008 citer != contents.end(); ++citer) {
2009 const cricket::ContentInfo* content = (&*citer); 2009 const cricket::ContentInfo* content = (&*citer);
2010 ASSERT(content != NULL); 2010 RTC_DCHECK(content != NULL);
2011 if (bundle_group->HasContentName(content->name) && 2011 if (bundle_group->HasContentName(content->name) &&
2012 !content->rejected && content->type == cricket::NS_JINGLE_RTP) { 2012 !content->rejected && content->type == cricket::NS_JINGLE_RTP) {
2013 if (!HasRtcpMuxEnabled(content)) 2013 if (!HasRtcpMuxEnabled(content))
2014 return false; 2014 return false;
2015 } 2015 }
2016 } 2016 }
2017 // RTCP-MUX is enabled in all the contents. 2017 // RTCP-MUX is enabled in all the contents.
2018 return true; 2018 return true;
2019 } 2019 }
2020 2020
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 return transport_controller_->ReadyForRemoteCandidates(transport_name); 2153 return transport_controller_->ReadyForRemoteCandidates(transport_name);
2154 } 2154 }
2155 2155
2156 bool WebRtcSession::SrtpRequired() const { 2156 bool WebRtcSession::SrtpRequired() const {
2157 return dtls_enabled_ || 2157 return dtls_enabled_ ||
2158 webrtc_session_desc_factory_->SdesPolicy() == cricket::SEC_REQUIRED; 2158 webrtc_session_desc_factory_->SdesPolicy() == cricket::SEC_REQUIRED;
2159 } 2159 }
2160 2160
2161 void WebRtcSession::OnTransportControllerGatheringState( 2161 void WebRtcSession::OnTransportControllerGatheringState(
2162 cricket::IceGatheringState state) { 2162 cricket::IceGatheringState state) {
2163 ASSERT(signaling_thread()->IsCurrent()); 2163 RTC_DCHECK(signaling_thread()->IsCurrent());
2164 if (state == cricket::kIceGatheringGathering) { 2164 if (state == cricket::kIceGatheringGathering) {
2165 if (ice_observer_) { 2165 if (ice_observer_) {
2166 ice_observer_->OnIceGatheringChange( 2166 ice_observer_->OnIceGatheringChange(
2167 PeerConnectionInterface::kIceGatheringGathering); 2167 PeerConnectionInterface::kIceGatheringGathering);
2168 } 2168 }
2169 } else if (state == cricket::kIceGatheringComplete) { 2169 } else if (state == cricket::kIceGatheringComplete) {
2170 if (ice_observer_) { 2170 if (ice_observer_) {
2171 ice_observer_->OnIceGatheringChange( 2171 ice_observer_->OnIceGatheringChange(
2172 PeerConnectionInterface::kIceGatheringComplete); 2172 PeerConnectionInterface::kIceGatheringComplete);
2173 } 2173 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 return *sctp_transport_name_; 2312 return *sctp_transport_name_;
2313 } 2313 }
2314 } 2314 }
2315 // Return an empty string if failed to retrieve the transport name. 2315 // Return an empty string if failed to retrieve the transport name.
2316 return ""; 2316 return "";
2317 } 2317 }
2318 return channel->transport_name(); 2318 return channel->transport_name();
2319 } 2319 }
2320 2320
2321 } // namespace webrtc 2321 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsdp.cc ('k') | webrtc/api/webrtcsessiondescriptionfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698