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

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

Issue 10833061: Rolling libjingle revison r163. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
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/peer_connection_handler_jsep.h" 5 #include "content/renderer/media/peer_connection_handler_jsep.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/stringprintf.h"
13 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
14 #include "content/renderer/media/media_stream_dependency_factory.h" 15 #include "content/renderer/media/media_stream_dependency_factory.h"
15 #include "content/renderer/media/media_stream_impl.h" 16 #include "content/renderer/media/media_stream_impl.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandid ateDescriptor.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandid ateDescriptor.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICEOption s.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICEOption s.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ction00HandlerClient.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ction00HandlerClient.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaHint s.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaHint s.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSessionDe scriptionDescriptor.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSessionDe scriptionDescriptor.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 default: 147 default:
147 NOTREACHED(); 148 NOTREACHED();
148 return false; 149 return false;
149 } 150 }
150 native_peer_connection_->StartIce(native_options); 151 native_peer_connection_->StartIce(native_options);
151 return true; 152 return true;
152 } 153 }
153 154
154 bool PeerConnectionHandlerJsep::processIceMessage( 155 bool PeerConnectionHandlerJsep::processIceMessage(
155 const WebKit::WebICECandidateDescriptor& candidate) { 156 const WebKit::WebICECandidateDescriptor& candidate) {
157 int m_line_index = -1;
158 if (!base::StringToInt(UTF16ToUTF8(candidate.label()), &m_line_index)) {
159 LOG(ERROR) << "Invalid candidate label: "
160 << UTF16ToUTF8(candidate.label());
161 return false;
162 }
163
Ronghua Wu (Left Chromium) 2012/07/30 18:09:10 // TODO: Set sdp_mid when mid is available in WebI
Mallinath (Gone from Chromium) 2012/07/30 18:42:08 Done.
156 scoped_ptr<webrtc::IceCandidateInterface> native_candidate( 164 scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
157 dependency_factory_->CreateIceCandidate( 165 dependency_factory_->CreateIceCandidate(
158 UTF16ToUTF8(candidate.label()), 166 "",
Ronghua Wu (Left Chromium) 2012/07/30 18:09:10 use sdp_mid
Mallinath (Gone from Chromium) 2012/07/30 18:42:08 Done.
167 m_line_index,
159 UTF16ToUTF8(candidate.candidateLine()))); 168 UTF16ToUTF8(candidate.candidateLine())));
160 if (!native_candidate.get()) { 169 if (!native_candidate.get()) {
161 LOG(ERROR) << "Could not create native ICE candidate"; 170 LOG(ERROR) << "Could not create native ICE candidate";
162 return false; 171 return false;
163 } 172 }
164 173
165 bool return_value = 174 bool return_value =
166 native_peer_connection_->ProcessIceMessage(native_candidate.get()); 175 native_peer_connection_->ProcessIceMessage(native_candidate.get());
167 if (!return_value) 176 if (!return_value)
168 LOG(ERROR) << "Error processing ICE message"; 177 LOG(ERROR) << "Error processing ICE message";
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 WebKit::WebMediaStreamDescriptor descriptor = it->second; 281 WebKit::WebMediaStreamDescriptor descriptor = it->second;
273 DCHECK(!descriptor.isNull()); 282 DCHECK(!descriptor.isNull());
274 remote_streams_.erase(it); 283 remote_streams_.erase(it);
275 client_->didRemoveRemoteStream(descriptor); 284 client_->didRemoveRemoteStream(descriptor);
276 } 285 }
277 286
278 void PeerConnectionHandlerJsep::OnIceCandidate( 287 void PeerConnectionHandlerJsep::OnIceCandidate(
279 const webrtc::IceCandidateInterface* candidate) { 288 const webrtc::IceCandidateInterface* candidate) {
280 WebKit::WebICECandidateDescriptor web_candidate; 289 WebKit::WebICECandidateDescriptor web_candidate;
281 290
282 std::string label = candidate->label(); 291 std::string label = StringPrintf("%d", candidate->sdp_mline_index());
283 std::string sdp; 292 std::string sdp;
284 if (!candidate->ToString(&sdp)) { 293 if (!candidate->ToString(&sdp)) {
285 LOG(ERROR) << "Could not get SDP string"; 294 LOG(ERROR) << "Could not get SDP string";
286 return; 295 return;
287 } 296 }
288 297
289 web_candidate.initialize(UTF8ToUTF16(label), UTF8ToUTF16(sdp)); 298 web_candidate.initialize(UTF8ToUTF16(label), UTF8ToUTF16(sdp));
290 299
291 // moreToFollow parameter isn't supported in native PeerConnection, so we 300 // moreToFollow parameter isn't supported in native PeerConnection, so we
292 // always use true here, and then false in OnIceComplete(). 301 // always use true here, and then false in OnIceComplete().
(...skipping 13 matching lines...) Expand all
306 std::string initial_sdp = UTF16ToUTF8(description.initialSDP()); 315 std::string initial_sdp = UTF16ToUTF8(description.initialSDP());
307 webrtc::SessionDescriptionInterface* native_desc = 316 webrtc::SessionDescriptionInterface* native_desc =
308 dependency_factory_->CreateSessionDescription(initial_sdp); 317 dependency_factory_->CreateSessionDescription(initial_sdp);
309 if (!native_desc) { 318 if (!native_desc) {
310 LOG(ERROR) << "Failed to create native session description"; 319 LOG(ERROR) << "Failed to create native session description";
311 return NULL; 320 return NULL;
312 } 321 }
313 322
314 for (size_t i = 0; i < description.numberOfAddedCandidates(); ++i) { 323 for (size_t i = 0; i < description.numberOfAddedCandidates(); ++i) {
315 WebKit::WebICECandidateDescriptor candidate = description.candidate(i); 324 WebKit::WebICECandidateDescriptor candidate = description.candidate(i);
325 int m_line_index = -1;
326 if (!base::StringToInt(UTF16ToUTF8(candidate.label()), &m_line_index)) {
327 LOG(ERROR) << "Invalid candidate label: "
328 << UTF16ToUTF8(candidate.label());
329 continue;
330 }
316 scoped_ptr<webrtc::IceCandidateInterface> native_candidate( 331 scoped_ptr<webrtc::IceCandidateInterface> native_candidate(
317 dependency_factory_->CreateIceCandidate( 332 dependency_factory_->CreateIceCandidate(
318 UTF16ToUTF8(candidate.label()), 333 "",
Ronghua Wu (Left Chromium) 2012/07/30 18:09:10 dito
Mallinath (Gone from Chromium) 2012/07/30 18:42:08 Done.
334 m_line_index,
319 UTF16ToUTF8(candidate.candidateLine()))); 335 UTF16ToUTF8(candidate.candidateLine())));
320 if (!native_desc->AddCandidate(native_candidate.get())) 336 if (!native_desc->AddCandidate(native_candidate.get()))
321 LOG(ERROR) << "Failed to add candidate to native session description"; 337 LOG(ERROR) << "Failed to add candidate to native session description";
322 } 338 }
323 339
324 return native_desc; 340 return native_desc;
325 } 341 }
326 342
327 WebKit::WebSessionDescriptionDescriptor 343 WebKit::WebSessionDescriptionDescriptor
328 PeerConnectionHandlerJsep::CreateWebKitSessionDescription( 344 PeerConnectionHandlerJsep::CreateWebKitSessionDescription(
(...skipping 26 matching lines...) Expand all
355 break; 371 break;
356 case ActionSDPAnswer: 372 case ActionSDPAnswer:
357 *native_action = webrtc::PeerConnectionInterface::kAnswer; 373 *native_action = webrtc::PeerConnectionInterface::kAnswer;
358 break; 374 break;
359 default: 375 default:
360 NOTREACHED(); 376 NOTREACHED();
361 return false; 377 return false;
362 } 378 }
363 return true; 379 return true;
364 } 380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698