Thanks to visit codestin.com
Credit goes to webrtc.googlesource.com

blob: 1d1b0be941745bfe600a45f072c70503806bf04c [file] [log] [blame]
Steve Anton97a9f762017-10-06 17:14:031/*
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
Steve Anton10542f22019-01-11 17:11:0011#ifndef PC_SDP_UTILS_H_
12#define PC_SDP_UTILS_H_
Steve Anton97a9f762017-10-06 17:14:0313
14#include <functional>
15#include <memory>
Steve Anton97a9f762017-10-06 17:14:0316
Harald Alvestrandf94ebc72025-10-08 12:31:1017#include "absl/base/macros.h"
Steve Anton97a9f762017-10-06 17:14:0318#include "api/jsep.h"
Harald Alvestrand5761e7b2021-01-29 14:45:0819#include "p2p/base/transport_info.h"
Steve Anton10542f22019-01-11 17:11:0020#include "pc/session_description.h"
Mirko Bonadei3ac63752019-11-05 08:56:3221#include "rtc_base/system/rtc_export.h"
Steve Anton97a9f762017-10-06 17:14:0322
23namespace webrtc {
24
25// Returns a copy of the given session description.
Harald Alvestrandf94ebc72025-10-08 12:31:1026// Deprecated in favor of SessionDescriptionInterface::Clone()
27ABSL_DEPRECATE_AND_INLINE()
28inline std::unique_ptr<SessionDescriptionInterface> CloneSessionDescription(
29 const SessionDescriptionInterface* sdesc) {
30 return sdesc->Clone();
31}
Steve Anton97a9f762017-10-06 17:14:0332
Steve Anton8d3444d2017-10-20 22:30:5133// Returns a copy of the given session description with the type changed.
Mirko Bonadei3ac63752019-11-05 08:56:3234RTC_EXPORT std::unique_ptr<SessionDescriptionInterface>
35CloneSessionDescriptionAsType(const SessionDescriptionInterface* sdesc,
36 SdpType type);
Steve Anton8d3444d2017-10-20 22:30:5137
Steve Anton97a9f762017-10-06 17:14:0338// Function that takes a single session description content with its
39// corresponding transport and produces a boolean.
Evan Shrubsole080cdac2025-03-20 09:34:4840typedef std::function<bool(const webrtc::ContentInfo*,
Evan Shrubsole945e5172025-04-08 14:11:4541 const webrtc::TransportInfo*)>
Steve Anton97a9f762017-10-06 17:14:0342 SdpContentPredicate;
43
44// Returns true if the predicate returns true for all contents in the given
45// session description.
Evan Shrubsole080cdac2025-03-20 09:34:4846bool SdpContentsAll(SdpContentPredicate pred, const SessionDescription* desc);
Steve Anton97a9f762017-10-06 17:14:0347
48// Returns true if the predicate returns true for none of the contents in the
49// given session description.
Evan Shrubsole080cdac2025-03-20 09:34:4850bool SdpContentsNone(SdpContentPredicate pred, const SessionDescription* desc);
Steve Anton97a9f762017-10-06 17:14:0351
52// Function that takes a single session description content with its
53// corresponding transport and can mutate the content and/or the transport.
Evan Shrubsole945e5172025-04-08 14:11:4554typedef std::function<void(webrtc::ContentInfo*, webrtc::TransportInfo*)>
Steve Anton97a9f762017-10-06 17:14:0355 SdpContentMutator;
56
57// Applies the mutator function over all contents in the given session
58// description.
Evan Shrubsole080cdac2025-03-20 09:34:4859void SdpContentsForEach(SdpContentMutator fn, SessionDescription* desc);
Steve Anton97a9f762017-10-06 17:14:0360
61} // namespace webrtc
62
Steve Anton10542f22019-01-11 17:11:0063#endif // PC_SDP_UTILS_H_