OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 // Update stats here so that we have the most recent stats for tracks and | 609 // Update stats here so that we have the most recent stats for tracks and |
610 // streams that might be removed by updating the session description. | 610 // streams that might be removed by updating the session description. |
611 stats_->UpdateStats(kStatsOutputLevelStandard); | 611 stats_->UpdateStats(kStatsOutputLevelStandard); |
612 std::string error; | 612 std::string error; |
613 if (!session_->SetLocalDescription(desc, &error)) { | 613 if (!session_->SetLocalDescription(desc, &error)) { |
614 PostSetSessionDescriptionFailure(observer, error); | 614 PostSetSessionDescriptionFailure(observer, error); |
615 return; | 615 return; |
616 } | 616 } |
617 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); | 617 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); |
618 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); | 618 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); |
619 // MaybeStartGathering needs to be called after posting | |
620 // MSG_SET_SESSIONDESCRIPTION_SUCCESS, so that we don't signal any candidates | |
621 // before signaling that SetLocalDescription completed. | |
622 session_->MaybeStartGathering(); | |
623 } | 619 } |
624 | 620 |
625 void PeerConnection::SetRemoteDescription( | 621 void PeerConnection::SetRemoteDescription( |
626 SetSessionDescriptionObserver* observer, | 622 SetSessionDescriptionObserver* observer, |
627 SessionDescriptionInterface* desc) { | 623 SessionDescriptionInterface* desc) { |
628 if (!VERIFY(observer != NULL)) { | 624 if (!VERIFY(observer != NULL)) { |
629 LOG(LS_ERROR) << "SetRemoteDescription - observer is NULL."; | 625 LOG(LS_ERROR) << "SetRemoteDescription - observer is NULL."; |
630 return; | 626 return; |
631 } | 627 } |
632 if (!desc) { | 628 if (!desc) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 stream_handler_container_->RemoveLocalTrack(stream, video_track); | 861 stream_handler_container_->RemoveLocalTrack(stream, video_track); |
866 } | 862 } |
867 | 863 |
868 void PeerConnection::OnRemoveLocalStream(MediaStreamInterface* stream) { | 864 void PeerConnection::OnRemoveLocalStream(MediaStreamInterface* stream) { |
869 stream_handler_container_->RemoveLocalStream(stream); | 865 stream_handler_container_->RemoveLocalStream(stream); |
870 } | 866 } |
871 | 867 |
872 void PeerConnection::OnIceConnectionChange( | 868 void PeerConnection::OnIceConnectionChange( |
873 PeerConnectionInterface::IceConnectionState new_state) { | 869 PeerConnectionInterface::IceConnectionState new_state) { |
874 ASSERT(signaling_thread()->IsCurrent()); | 870 ASSERT(signaling_thread()->IsCurrent()); |
875 // After transitioning to "closed", ignore any additional states from | |
876 // WebRtcSession (such as "disconnected"). | |
877 if (ice_connection_state_ == kIceConnectionClosed) { | |
878 return; | |
879 } | |
880 ice_connection_state_ = new_state; | 871 ice_connection_state_ = new_state; |
881 observer_->OnIceConnectionChange(ice_connection_state_); | 872 observer_->OnIceConnectionChange(ice_connection_state_); |
882 } | 873 } |
883 | 874 |
884 void PeerConnection::OnIceGatheringChange( | 875 void PeerConnection::OnIceGatheringChange( |
885 PeerConnectionInterface::IceGatheringState new_state) { | 876 PeerConnectionInterface::IceGatheringState new_state) { |
886 ASSERT(signaling_thread()->IsCurrent()); | 877 ASSERT(signaling_thread()->IsCurrent()); |
887 if (IsClosed()) { | 878 if (IsClosed()) { |
888 return; | 879 return; |
889 } | 880 } |
(...skipping 25 matching lines...) Expand all Loading... |
915 if (ice_gathering_state_ != kIceGatheringComplete) { | 906 if (ice_gathering_state_ != kIceGatheringComplete) { |
916 ice_gathering_state_ = kIceGatheringComplete; | 907 ice_gathering_state_ = kIceGatheringComplete; |
917 observer_->OnIceGatheringChange(ice_gathering_state_); | 908 observer_->OnIceGatheringChange(ice_gathering_state_); |
918 } | 909 } |
919 } | 910 } |
920 observer_->OnSignalingChange(signaling_state_); | 911 observer_->OnSignalingChange(signaling_state_); |
921 observer_->OnStateChange(PeerConnectionObserver::kSignalingState); | 912 observer_->OnStateChange(PeerConnectionObserver::kSignalingState); |
922 } | 913 } |
923 | 914 |
924 } // namespace webrtc | 915 } // namespace webrtc |
OLD | NEW |