Chromium Code Reviews| Index: content/renderer/media/media_stream_center.cc |
| =================================================================== |
| --- content/renderer/media/media_stream_center.cc (revision 148953) |
| +++ content/renderer/media/media_stream_center.cc (working copy) |
| @@ -7,6 +7,7 @@ |
| #include <string> |
| #include "base/logging.h" |
| +#include "base/string_number_conversions.h" |
|
wjia(left Chromium)
2012/07/30 18:19:10
file order.
Mallinath (Gone from Chromium)
2012/07/30 18:42:08
Done.
|
| #include "base/memory/scoped_ptr.h" |
| #include "base/utf_string_conversions.h" |
| #include "content/renderer/media/media_stream_impl.h" |
| @@ -141,8 +142,14 @@ |
| WebKit::WebString MediaStreamCenter::constructSDP( |
| 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 WebKit::WebString(); |
| + } |
| scoped_ptr<webrtc::IceCandidateInterface> native_candidate( |
| webrtc::CreateIceCandidate(UTF16ToUTF8(candidate.label()), |
| + m_line_index, |
| UTF16ToUTF8(candidate.candidateLine()))); |
| std::string sdp; |
| if (!native_candidate->ToString(&sdp)) |
| @@ -159,8 +166,15 @@ |
| 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( |
| webrtc::CreateIceCandidate(UTF16ToUTF8(candidate.label()), |
| + m_line_index, |
| UTF16ToUTF8(candidate.candidateLine()))); |
| native_desc->AddCandidate(native_candidate.get()); |
| } |