blob: 5e765fa586fe3f1e97ced9e2ce7f6705b5c11661 [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 Anton36b29d12017-10-30 16:57:4216#include <string>
Steve Anton97a9f762017-10-06 17:14:0317
18#include "api/jsep.h"
Steve Anton10542f22019-01-11 17:11:0019#include "pc/session_description.h"
Steve Anton97a9f762017-10-06 17:14:0320
21namespace webrtc {
22
23// Returns a copy of the given session description.
24std::unique_ptr<SessionDescriptionInterface> CloneSessionDescription(
25 const SessionDescriptionInterface* sdesc);
26
Steve Anton8d3444d2017-10-20 22:30:5127// Returns a copy of the given session description with the type changed.
28std::unique_ptr<SessionDescriptionInterface> CloneSessionDescriptionAsType(
29 const SessionDescriptionInterface* sdesc,
Steve Antona3a92c22017-12-07 18:27:4130 SdpType type);
Steve Anton8d3444d2017-10-20 22:30:5131
Steve Anton97a9f762017-10-06 17:14:0332// Function that takes a single session description content with its
33// corresponding transport and produces a boolean.
34typedef std::function<bool(const cricket::ContentInfo*,
35 const cricket::TransportInfo*)>
36 SdpContentPredicate;
37
38// Returns true if the predicate returns true for all contents in the given
39// session description.
40bool SdpContentsAll(SdpContentPredicate pred,
41 const cricket::SessionDescription* desc);
42
43// Returns true if the predicate returns true for none of the contents in the
44// given session description.
45bool SdpContentsNone(SdpContentPredicate pred,
46 const cricket::SessionDescription* desc);
47
48// Function that takes a single session description content with its
49// corresponding transport and can mutate the content and/or the transport.
50typedef std::function<void(cricket::ContentInfo*, cricket::TransportInfo*)>
51 SdpContentMutator;
52
53// Applies the mutator function over all contents in the given session
54// description.
55void SdpContentsForEach(SdpContentMutator fn,
56 cricket::SessionDescription* desc);
57
58} // namespace webrtc
59
Steve Anton10542f22019-01-11 17:11:0060#endif // PC_SDP_UTILS_H_