blob: f556fe39775487cc2383f129d6a3892b0aa28447 [file] [log] [blame]
Steve Anton1d03a752017-11-27 14:30:09 -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
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef PC_RTP_MEDIA_UTILS_H_
12#define PC_RTP_MEDIA_UTILS_H_
Steve Anton1d03a752017-11-27 14:30:09 -080013
Steve Anton10542f22019-01-11 09:11:00 -080014#include "api/rtp_transceiver_interface.h"
Steve Anton1d03a752017-11-27 14:30:09 -080015
16namespace webrtc {
17
18// Returns the RtpTransceiverDirection that satisfies specified send and receive
19// conditions.
20RtpTransceiverDirection RtpTransceiverDirectionFromSendRecv(bool send,
21 bool recv);
22
23// Returns true only if the direction will send media.
24bool RtpTransceiverDirectionHasSend(RtpTransceiverDirection direction);
25
26// Returns true only if the direction will receive media.
27bool RtpTransceiverDirectionHasRecv(RtpTransceiverDirection direction);
28
29// Returns the RtpTransceiverDirection which is the reverse of the given
30// direction.
31RtpTransceiverDirection RtpTransceiverDirectionReversed(
32 RtpTransceiverDirection direction);
33
Steve Anton22da89f2018-01-25 13:58:07 -080034// Returns the RtpTransceiverDirection with its send component set to |send|.
35RtpTransceiverDirection RtpTransceiverDirectionWithSendSet(
36 RtpTransceiverDirection direction,
37 bool send = true);
38
39// Returns the RtpTransceiverDirection with its recv component set to |recv|.
40RtpTransceiverDirection RtpTransceiverDirectionWithRecvSet(
41 RtpTransceiverDirection direction,
42 bool recv = true);
43
Steve Anton4e70a722017-11-28 14:57:10 -080044// Returns an unspecified string representation of the given direction.
45const char* RtpTransceiverDirectionToString(RtpTransceiverDirection direction);
46
Guido Urdaneta70c2db12019-04-16 12:24:14 +020047// Returns the intersection of the directions of two transceivers.
48RtpTransceiverDirection RtpTransceiverDirectionIntersection(
49 RtpTransceiverDirection lhs,
50 RtpTransceiverDirection rhs);
51
Jonas Olsson3e18c822018-04-18 10:11:07 +020052#ifdef UNIT_TEST
53inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982)
54 std::ostream& os, // no-presubmit-check TODO(webrtc:8982)
55 RtpTransceiverDirection direction) {
56 return os << RtpTransceiverDirectionToString(direction);
57}
58#endif // UNIT_TEST
59
Steve Anton1d03a752017-11-27 14:30:09 -080060} // namespace webrtc
61
Steve Anton10542f22019-01-11 09:11:00 -080062#endif // PC_RTP_MEDIA_UTILS_H_