blob: ddb39b6181e9a894ba79ce358b28dcb2b6b5081c [file] [log] [blame]
Steve Anton845bb732017-12-05 12:50:26 -08001/*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "api/jsep.h"
12
13namespace webrtc {
14
15std::string IceCandidateInterface::server_url() const {
16 return "";
17}
18
19size_t SessionDescriptionInterface::RemoveCandidates(
20 const std::vector<cricket::Candidate>& candidates) {
21 return 0;
22}
23
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +020024void CreateSessionDescriptionObserver::OnFailure(RTCError error) {
25 OnFailure(error.message());
26}
27
28void CreateSessionDescriptionObserver::OnFailure(const std::string& error) {
29 OnFailure(RTCError(RTCErrorType::INTERNAL_ERROR, std::string(error)));
30}
31
32void SetSessionDescriptionObserver::OnFailure(RTCError error) {
33 std::string message(error.message());
34 OnFailure(message);
35}
36
37void SetSessionDescriptionObserver::OnFailure(const std::string& error) {
38 OnFailure(RTCError(RTCErrorType::INTERNAL_ERROR, std::string(error)));
39}
40
Mirko Bonadei93428bf2018-10-11 09:24:21 +020041const char SessionDescriptionInterface::kOffer[] = "offer";
42const char SessionDescriptionInterface::kPrAnswer[] = "pranswer";
43const char SessionDescriptionInterface::kAnswer[] = "answer";
Eldar Rello5ab79e62019-10-09 18:29:44 +030044const char SessionDescriptionInterface::kRollback[] = "rollback";
Mirko Bonadei93428bf2018-10-11 09:24:21 +020045
46const char* SdpTypeToString(SdpType type) {
47 switch (type) {
48 case SdpType::kOffer:
49 return SessionDescriptionInterface::kOffer;
50 case SdpType::kPrAnswer:
51 return SessionDescriptionInterface::kPrAnswer;
52 case SdpType::kAnswer:
53 return SessionDescriptionInterface::kAnswer;
Eldar Rello5ab79e62019-10-09 18:29:44 +030054 case SdpType::kRollback:
55 return SessionDescriptionInterface::kRollback;
Mirko Bonadei93428bf2018-10-11 09:24:21 +020056 }
57 return "";
58}
59
60absl::optional<SdpType> SdpTypeFromString(const std::string& type_str) {
61 if (type_str == SessionDescriptionInterface::kOffer) {
62 return SdpType::kOffer;
63 } else if (type_str == SessionDescriptionInterface::kPrAnswer) {
64 return SdpType::kPrAnswer;
65 } else if (type_str == SessionDescriptionInterface::kAnswer) {
66 return SdpType::kAnswer;
Eldar Rello5ab79e62019-10-09 18:29:44 +030067 } else if (type_str == SessionDescriptionInterface::kRollback) {
68 return SdpType::kRollback;
Mirko Bonadei93428bf2018-10-11 09:24:21 +020069 } else {
70 return absl::nullopt;
71 }
72}
73
Steve Anton845bb732017-12-05 12:50:26 -080074} // namespace webrtc