Chromium Code Reviews| 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,17 @@ |
| 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; |
| + } |
| + |
|
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.
|
| scoped_ptr<webrtc::IceCandidateInterface> native_candidate( |
| dependency_factory_->CreateIceCandidate( |
| - UTF16ToUTF8(candidate.label()), |
| + "", |
|
Ronghua Wu (Left Chromium)
2012/07/30 18:09:10
use sdp_mid
Mallinath (Gone from Chromium)
2012/07/30 18:42:08
Done.
|
| + m_line_index, |
| UTF16ToUTF8(candidate.candidateLine()))); |
| if (!native_candidate.get()) { |
| LOG(ERROR) << "Could not create native ICE candidate"; |
| @@ -279,7 +288,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"; |
| @@ -313,9 +322,16 @@ |
| 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()), |
| + "", |
|
Ronghua Wu (Left Chromium)
2012/07/30 18:09:10
dito
Mallinath (Gone from Chromium)
2012/07/30 18:42:08
Done.
|
| + m_line_index, |
| UTF16ToUTF8(candidate.candidateLine()))); |
| if (!native_desc->AddCandidate(native_candidate.get())) |
| LOG(ERROR) << "Failed to add candidate to native session description"; |