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

Side by Side Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 468393003: Add the addIceCandidate failure case to webrtc-internals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/media/rtc_peer_connection_handler.h" 5 #include "content/renderer/media/rtc_peer_connection_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 return true; 633 return true;
634 } 634 }
635 635
636 bool RTCPeerConnectionHandler::addICECandidate( 636 bool RTCPeerConnectionHandler::addICECandidate(
637 const blink::WebRTCICECandidate& candidate) { 637 const blink::WebRTCICECandidate& candidate) {
638 scoped_ptr<webrtc::IceCandidateInterface> native_candidate( 638 scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
639 dependency_factory_->CreateIceCandidate( 639 dependency_factory_->CreateIceCandidate(
640 base::UTF16ToUTF8(candidate.sdpMid()), 640 base::UTF16ToUTF8(candidate.sdpMid()),
641 candidate.sdpMLineIndex(), 641 candidate.sdpMLineIndex(),
642 base::UTF16ToUTF8(candidate.candidate()))); 642 base::UTF16ToUTF8(candidate.candidate())));
643 if (!native_candidate) { 643 bool return_value = false;
644
645 if (native_candidate) {
646 return_value =
647 native_peer_connection_->AddIceCandidate(native_candidate.get());
648 LOG_IF(ERROR, !return_value) << "Error processing ICE candidate.";
649 } else {
644 LOG(ERROR) << "Could not create native ICE candidate."; 650 LOG(ERROR) << "Could not create native ICE candidate.";
645 return false;
646 } 651 }
647 652
648 bool return_value = 653 if (peer_connection_tracker_) {
649 native_peer_connection_->AddIceCandidate(native_candidate.get());
650 LOG_IF(ERROR, !return_value) << "Error processing ICE candidate.";
651
652 if (peer_connection_tracker_)
653 peer_connection_tracker_->TrackAddIceCandidate( 654 peer_connection_tracker_->TrackAddIceCandidate(
654 this, candidate, PeerConnectionTracker::SOURCE_REMOTE); 655 this, candidate, PeerConnectionTracker::SOURCE_REMOTE, return_value);
655 656 }
656 return return_value; 657 return return_value;
657 } 658 }
658 659
659 void RTCPeerConnectionHandler::OnaddICECandidateResult( 660 void RTCPeerConnectionHandler::OnaddICECandidateResult(
660 const blink::WebRTCVoidRequest& webkit_request, bool result) { 661 const blink::WebRTCVoidRequest& webkit_request, bool result) {
661 if (!result) { 662 if (!result) {
662 // We don't have the actual error code from the libjingle, so for now 663 // We don't have the actual error code from the libjingle, so for now
663 // using a generic error string. 664 // using a generic error string.
664 return webkit_request.requestFailed( 665 return webkit_request.requestFailed(
665 base::UTF8ToUTF16("Error processing ICE candidate")); 666 base::UTF8ToUTF16("Error processing ICE candidate"));
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 if (!candidate->ToString(&sdp)) { 956 if (!candidate->ToString(&sdp)) {
956 NOTREACHED() << "OnIceCandidate: Could not get SDP string."; 957 NOTREACHED() << "OnIceCandidate: Could not get SDP string.";
957 return; 958 return;
958 } 959 }
959 blink::WebRTCICECandidate web_candidate; 960 blink::WebRTCICECandidate web_candidate;
960 web_candidate.initialize(base::UTF8ToUTF16(sdp), 961 web_candidate.initialize(base::UTF8ToUTF16(sdp),
961 base::UTF8ToUTF16(candidate->sdp_mid()), 962 base::UTF8ToUTF16(candidate->sdp_mid()),
962 candidate->sdp_mline_index()); 963 candidate->sdp_mline_index());
963 if (peer_connection_tracker_) 964 if (peer_connection_tracker_)
964 peer_connection_tracker_->TrackAddIceCandidate( 965 peer_connection_tracker_->TrackAddIceCandidate(
965 this, web_candidate, PeerConnectionTracker::SOURCE_LOCAL); 966 this, web_candidate, PeerConnectionTracker::SOURCE_LOCAL, true);
966 967
967 client_->didGenerateICECandidate(web_candidate); 968 client_->didGenerateICECandidate(web_candidate);
968 } 969 }
969 970
970 void RTCPeerConnectionHandler::OnDataChannel( 971 void RTCPeerConnectionHandler::OnDataChannel(
971 webrtc::DataChannelInterface* data_channel) { 972 webrtc::DataChannelInterface* data_channel) {
972 if (peer_connection_tracker_) 973 if (peer_connection_tracker_)
973 peer_connection_tracker_->TrackCreateDataChannel( 974 peer_connection_tracker_->TrackCreateDataChannel(
974 this, data_channel, PeerConnectionTracker::SOURCE_REMOTE); 975 this, data_channel, PeerConnectionTracker::SOURCE_REMOTE);
975 976
(...skipping 21 matching lines...) Expand all
997 webrtc::SessionDescriptionInterface* native_desc = 998 webrtc::SessionDescriptionInterface* native_desc =
998 dependency_factory_->CreateSessionDescription(type, sdp, error); 999 dependency_factory_->CreateSessionDescription(type, sdp, error);
999 1000
1000 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." 1001 LOG_IF(ERROR, !native_desc) << "Failed to create native session description."
1001 << " Type: " << type << " SDP: " << sdp; 1002 << " Type: " << type << " SDP: " << sdp;
1002 1003
1003 return native_desc; 1004 return native_desc;
1004 } 1005 }
1005 1006
1006 } // namespace content 1007 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698