blob: 01f5720563d908347f5dcb5f4381b9b21c4bb98b [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";
44
45const char* SdpTypeToString(SdpType type) {
46 switch (type) {
47 case SdpType::kOffer:
48 return SessionDescriptionInterface::kOffer;
49 case SdpType::kPrAnswer:
50 return SessionDescriptionInterface::kPrAnswer;
51 case SdpType::kAnswer:
52 return SessionDescriptionInterface::kAnswer;
53 }
54 return "";
55}
56
57absl::optional<SdpType> SdpTypeFromString(const std::string& type_str) {
58 if (type_str == SessionDescriptionInterface::kOffer) {
59 return SdpType::kOffer;
60 } else if (type_str == SessionDescriptionInterface::kPrAnswer) {
61 return SdpType::kPrAnswer;
62 } else if (type_str == SessionDescriptionInterface::kAnswer) {
63 return SdpType::kAnswer;
64 } else {
65 return absl::nullopt;
66 }
67}
68
Steve Anton845bb732017-12-05 12:50:26 -080069} // namespace webrtc