Index: content/renderer/media/peer_connection_handler_jsep.cc |
=================================================================== |
--- content/renderer/media/peer_connection_handler_jsep.cc (revision 148953) |
+++ content/renderer/media/peer_connection_handler_jsep.cc (working copy) |
@@ -10,6 +10,7 @@ |
#include "base/bind.h" |
#include "base/logging.h" |
#include "base/string_number_conversions.h" |
+#include "base/stringprintf.h" |
#include "base/utf_string_conversions.h" |
#include "content/renderer/media/media_stream_dependency_factory.h" |
#include "content/renderer/media/media_stream_impl.h" |
@@ -153,9 +154,18 @@ |
bool PeerConnectionHandlerJsep::processIceMessage( |
const WebKit::WebICECandidateDescriptor& candidate) { |
+ int m_line_index = -1; |
+ if (!base::StringToInt(UTF16ToUTF8(candidate.label()), &m_line_index)) { |
+ LOG(ERROR) << "Invalid candidate label: " |
+ << UTF16ToUTF8(candidate.label()); |
+ return false; |
+ } |
+ // TODO: Use sdp_mid when its available, for now its empty string. |
Ronghua Wu (Left Chromium)
2012/07/30 18:59:00
You can put my name on the TODO. :)
Mallinath (Gone from Chromium)
2012/07/30 19:11:25
Sure.
On 2012/07/30 18:59:00, Ronghua Wu wrote:
|
+ const std::string sdp_mid = ""; |
scoped_ptr<webrtc::IceCandidateInterface> native_candidate( |
dependency_factory_->CreateIceCandidate( |
- UTF16ToUTF8(candidate.label()), |
+ sdp_mid, |
+ m_line_index, |
UTF16ToUTF8(candidate.candidateLine()))); |
if (!native_candidate.get()) { |
LOG(ERROR) << "Could not create native ICE candidate"; |
@@ -279,7 +289,7 @@ |
const webrtc::IceCandidateInterface* candidate) { |
WebKit::WebICECandidateDescriptor web_candidate; |
- std::string label = candidate->label(); |
+ std::string label = StringPrintf("%d", candidate->sdp_mline_index()); |
std::string sdp; |
if (!candidate->ToString(&sdp)) { |
LOG(ERROR) << "Could not get SDP string"; |
@@ -310,12 +320,20 @@ |
LOG(ERROR) << "Failed to create native session description"; |
return NULL; |
} |
- |
+ // TODO: Apply sdp_mid when its available, for now its empty string. |
+ const std::string sdp_mid = ""; |
for (size_t i = 0; i < description.numberOfAddedCandidates(); ++i) { |
WebKit::WebICECandidateDescriptor candidate = description.candidate(i); |
+ int m_line_index = -1; |
+ if (!base::StringToInt(UTF16ToUTF8(candidate.label()), &m_line_index)) { |
+ LOG(ERROR) << "Invalid candidate label: " |
+ << UTF16ToUTF8(candidate.label()); |
+ continue; |
+ } |
scoped_ptr<webrtc::IceCandidateInterface> native_candidate( |
dependency_factory_->CreateIceCandidate( |
- UTF16ToUTF8(candidate.label()), |
+ sdp_mid, |
+ m_line_index, |
UTF16ToUTF8(candidate.candidateLine()))); |
if (!native_desc->AddCandidate(native_candidate.get())) |
LOG(ERROR) << "Failed to add candidate to native session description"; |