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.

60 lines
2.1 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. #ifndef PC_SDP_UTILS_H_
  11. #define PC_SDP_UTILS_H_
  12. #include <functional>
  13. #include <memory>
  14. #include <string>
  15. #include "api/jsep.h"
  16. #include "pc/session_description.h"
  17. namespace webrtc {
  18. // Returns a copy of the given session description.
  19. std::unique_ptr<SessionDescriptionInterface> CloneSessionDescription(
  20. const SessionDescriptionInterface* sdesc);
  21. // Returns a copy of the given session description with the type changed.
  22. std::unique_ptr<SessionDescriptionInterface> CloneSessionDescriptionAsType(
  23. const SessionDescriptionInterface* sdesc,
  24. SdpType type);
  25. // Function that takes a single session description content with its
  26. // corresponding transport and produces a boolean.
  27. typedef std::function<bool(const cricket::ContentInfo*,
  28. const cricket::TransportInfo*)>
  29. SdpContentPredicate;
  30. // Returns true if the predicate returns true for all contents in the given
  31. // session description.
  32. bool SdpContentsAll(SdpContentPredicate pred,
  33. const cricket::SessionDescription* desc);
  34. // Returns true if the predicate returns true for none of the contents in the
  35. // given session description.
  36. bool SdpContentsNone(SdpContentPredicate pred,
  37. const cricket::SessionDescription* desc);
  38. // Function that takes a single session description content with its
  39. // corresponding transport and can mutate the content and/or the transport.
  40. typedef std::function<void(cricket::ContentInfo*, cricket::TransportInfo*)>
  41. SdpContentMutator;
  42. // Applies the mutator function over all contents in the given session
  43. // description.
  44. void SdpContentsForEach(SdpContentMutator fn,
  45. cricket::SessionDescription* desc);
  46. } // namespace webrtc
  47. #endif // PC_SDP_UTILS_H_