You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  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. #include "api/jsep.h"
  11. namespace webrtc {
  12. std::string IceCandidateInterface::server_url() const {
  13. return "";
  14. }
  15. size_t SessionDescriptionInterface::RemoveCandidates(
  16. const std::vector<cricket::Candidate>& candidates) {
  17. return 0;
  18. }
  19. void CreateSessionDescriptionObserver::OnFailure(RTCError error) {
  20. OnFailure(error.message());
  21. }
  22. void CreateSessionDescriptionObserver::OnFailure(const std::string& error) {
  23. OnFailure(RTCError(RTCErrorType::INTERNAL_ERROR, std::string(error)));
  24. }
  25. void SetSessionDescriptionObserver::OnFailure(RTCError error) {
  26. std::string message(error.message());
  27. OnFailure(message);
  28. }
  29. void SetSessionDescriptionObserver::OnFailure(const std::string& error) {
  30. OnFailure(RTCError(RTCErrorType::INTERNAL_ERROR, std::string(error)));
  31. }
  32. const char SessionDescriptionInterface::kOffer[] = "offer";
  33. const char SessionDescriptionInterface::kPrAnswer[] = "pranswer";
  34. const char SessionDescriptionInterface::kAnswer[] = "answer";
  35. const char SessionDescriptionInterface::kRollback[] = "rollback";
  36. const char* SdpTypeToString(SdpType type) {
  37. switch (type) {
  38. case SdpType::kOffer:
  39. return SessionDescriptionInterface::kOffer;
  40. case SdpType::kPrAnswer:
  41. return SessionDescriptionInterface::kPrAnswer;
  42. case SdpType::kAnswer:
  43. return SessionDescriptionInterface::kAnswer;
  44. case SdpType::kRollback:
  45. return SessionDescriptionInterface::kRollback;
  46. }
  47. return "";
  48. }
  49. absl::optional<SdpType> SdpTypeFromString(const std::string& type_str) {
  50. if (type_str == SessionDescriptionInterface::kOffer) {
  51. return SdpType::kOffer;
  52. } else if (type_str == SessionDescriptionInterface::kPrAnswer) {
  53. return SdpType::kPrAnswer;
  54. } else if (type_str == SessionDescriptionInterface::kAnswer) {
  55. return SdpType::kAnswer;
  56. } else if (type_str == SessionDescriptionInterface::kRollback) {
  57. return SdpType::kRollback;
  58. } else {
  59. return absl::nullopt;
  60. }
  61. }
  62. } // namespace webrtc