OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "remoting/protocol/webrtc_transport.h" | 5 #include "remoting/protocol/webrtc_transport.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 std::string description_sdp; | 465 std::string description_sdp; |
466 if (!description->ToString(&description_sdp)) { | 466 if (!description->ToString(&description_sdp)) { |
467 LOG(ERROR) << "Failed to serialize description."; | 467 LOG(ERROR) << "Failed to serialize description."; |
468 Close(CHANNEL_CONNECTION_ERROR); | 468 Close(CHANNEL_CONNECTION_ERROR); |
469 return; | 469 return; |
470 } | 470 } |
471 | 471 |
472 SdpMessage sdp_message(description_sdp); | 472 SdpMessage sdp_message(description_sdp); |
473 UpdateCodecParameters(&sdp_message, /*incoming=*/false); | 473 UpdateCodecParameters(&sdp_message, /*incoming=*/false); |
474 description_sdp = sdp_message.ToString(); | 474 description_sdp = sdp_message.ToString(); |
| 475 webrtc::SdpParseError parse_error; |
| 476 description.reset(webrtc::CreateSessionDescription( |
| 477 description->type(), description_sdp, &parse_error)); |
| 478 if (!description) { |
| 479 LOG(ERROR) << "Failed to parse the session description: " |
| 480 << parse_error.description << " line: " << parse_error.line; |
| 481 Close(CHANNEL_CONNECTION_ERROR); |
| 482 return; |
| 483 } |
475 | 484 |
476 // Format and send the session description to the peer. | 485 // Format and send the session description to the peer. |
477 std::unique_ptr<XmlElement> transport_info( | 486 std::unique_ptr<XmlElement> transport_info( |
478 new XmlElement(QName(kTransportNamespace, "transport"), true)); | 487 new XmlElement(QName(kTransportNamespace, "transport"), true)); |
479 XmlElement* offer_tag = | 488 XmlElement* offer_tag = |
480 new XmlElement(QName(kTransportNamespace, "session-description")); | 489 new XmlElement(QName(kTransportNamespace, "session-description")); |
481 transport_info->AddElement(offer_tag); | 490 transport_info->AddElement(offer_tag); |
482 offer_tag->SetAttr(QName(std::string(), "type"), description->type()); | 491 offer_tag->SetAttr(QName(std::string(), "type"), description->type()); |
483 offer_tag->SetBodyText(description_sdp); | 492 offer_tag->SetBodyText(description_sdp); |
484 | 493 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 // the stack and so it must be destroyed later. | 711 // the stack and so it must be destroyed later. |
703 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( | 712 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( |
704 FROM_HERE, peer_connection_wrapper_.release()); | 713 FROM_HERE, peer_connection_wrapper_.release()); |
705 | 714 |
706 if (error != OK) | 715 if (error != OK) |
707 event_handler_->OnWebrtcTransportError(error); | 716 event_handler_->OnWebrtcTransportError(error); |
708 } | 717 } |
709 | 718 |
710 } // namespace protocol | 719 } // namespace protocol |
711 } // namespace remoting | 720 } // namespace remoting |
OLD | NEW |