| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/cast_extension_session.h" | 5 #include "remoting/host/cast_extension_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 bool CastExtensionSession::connection_active() const { | 570 bool CastExtensionSession::connection_active() const { |
| 571 return peer_connection_.get() != nullptr; | 571 return peer_connection_.get() != nullptr; |
| 572 } | 572 } |
| 573 | 573 |
| 574 // webrtc::PeerConnectionObserver implementation ------------------------------- | 574 // webrtc::PeerConnectionObserver implementation ------------------------------- |
| 575 void CastExtensionSession::OnSignalingChange( | 575 void CastExtensionSession::OnSignalingChange( |
| 576 webrtc::PeerConnectionInterface::SignalingState new_state) { | 576 webrtc::PeerConnectionInterface::SignalingState new_state) { |
| 577 VLOG(1) << "PeerConnectionObserver: SignalingState changed to:" << new_state; | 577 VLOG(1) << "PeerConnectionObserver: SignalingState changed to:" << new_state; |
| 578 } | 578 } |
| 579 | 579 |
| 580 void CastExtensionSession::OnStateChange( | |
| 581 webrtc::PeerConnectionObserver::StateType state_changed) { | |
| 582 VLOG(1) << "PeerConnectionObserver: StateType changed to: " << state_changed; | |
| 583 } | |
| 584 | |
| 585 void CastExtensionSession::OnAddStream(webrtc::MediaStreamInterface* stream) { | 580 void CastExtensionSession::OnAddStream(webrtc::MediaStreamInterface* stream) { |
| 586 VLOG(1) << "PeerConnectionObserver: stream added: " << stream->label(); | 581 VLOG(1) << "PeerConnectionObserver: stream added: " << stream->label(); |
| 587 } | 582 } |
| 588 | 583 |
| 589 void CastExtensionSession::OnRemoveStream( | 584 void CastExtensionSession::OnRemoveStream( |
| 590 webrtc::MediaStreamInterface* stream) { | 585 webrtc::MediaStreamInterface* stream) { |
| 591 VLOG(1) << "PeerConnectionObserver: stream removed: " << stream->label(); | 586 VLOG(1) << "PeerConnectionObserver: stream removed: " << stream->label(); |
| 592 } | 587 } |
| 593 | 588 |
| 594 void CastExtensionSession::OnDataChannel( | 589 void CastExtensionSession::OnDataChannel( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 616 &CastExtensionSession::PollPeerConnectionStats); | 611 &CastExtensionSession::PollPeerConnectionStats); |
| 617 } | 612 } |
| 618 } | 613 } |
| 619 | 614 |
| 620 void CastExtensionSession::OnIceGatheringChange( | 615 void CastExtensionSession::OnIceGatheringChange( |
| 621 webrtc::PeerConnectionInterface::IceGatheringState new_state) { | 616 webrtc::PeerConnectionInterface::IceGatheringState new_state) { |
| 622 VLOG(1) << "PeerConnectionObserver: IceGatheringState changed to: " | 617 VLOG(1) << "PeerConnectionObserver: IceGatheringState changed to: " |
| 623 << new_state; | 618 << new_state; |
| 624 } | 619 } |
| 625 | 620 |
| 626 void CastExtensionSession::OnIceComplete() { | |
| 627 VLOG(1) << "PeerConnectionObserver: all ICE candidates found."; | |
| 628 } | |
| 629 | |
| 630 void CastExtensionSession::OnIceCandidate( | 621 void CastExtensionSession::OnIceCandidate( |
| 631 const webrtc::IceCandidateInterface* candidate) { | 622 const webrtc::IceCandidateInterface* candidate) { |
| 632 std::string candidate_str; | 623 std::string candidate_str; |
| 633 if (!candidate->ToString(&candidate_str)) { | 624 if (!candidate->ToString(&candidate_str)) { |
| 634 LOG(ERROR) << "PeerConnectionObserver: failed to serialize candidate."; | 625 LOG(ERROR) << "PeerConnectionObserver: failed to serialize candidate."; |
| 635 return; | 626 return; |
| 636 } | 627 } |
| 637 base::DictionaryValue json; | 628 base::DictionaryValue json; |
| 638 json.SetString(kWebRtcSDPMid, candidate->sdp_mid()); | 629 json.SetString(kWebRtcSDPMid, candidate->sdp_mid()); |
| 639 json.SetInteger(kWebRtcSDPMLineIndex, candidate->sdp_mline_index()); | 630 json.SetInteger(kWebRtcSDPMLineIndex, candidate->sdp_mline_index()); |
| 640 json.SetString(kWebRtcCandidate, candidate_str); | 631 json.SetString(kWebRtcCandidate, candidate_str); |
| 641 std::string json_str; | 632 std::string json_str; |
| 642 if (!base::JSONWriter::Write(json, &json_str)) { | 633 if (!base::JSONWriter::Write(json, &json_str)) { |
| 643 LOG(ERROR) << "Failed to serialize candidate message."; | 634 LOG(ERROR) << "Failed to serialize candidate message."; |
| 644 return; | 635 return; |
| 645 } | 636 } |
| 646 SendMessageToClient(kSubjectNewCandidate, json_str); | 637 SendMessageToClient(kSubjectNewCandidate, json_str); |
| 647 } | 638 } |
| 648 | 639 |
| 649 } // namespace remoting | 640 } // namespace remoting |
| OLD | NEW |