| 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 |
| 11 | #ifndef PC_RTP_MEDIA_UTILS_H_ |
| 12 | #define PC_RTP_MEDIA_UTILS_H_ |
| 13 |
| 14 | #include <ostream> // no-presubmit-check TODO(webrtc:8982) |
| 15 |
| 16 | #include "api/rtp_transceiver_direction.h" |
| 17 |
| 18 | namespace webrtc { |
| 19 |
| 20 | // Returns the RtpTransceiverDirection that satisfies specified send and receive |
| 21 | // conditions. |
| 22 | RtpTransceiverDirection RtpTransceiverDirectionFromSendRecv(bool send, |
| 23 | bool recv); |
| 24 |
| 25 | // Returns true only if the direction will send media. |
| 26 | bool RtpTransceiverDirectionHasSend(RtpTransceiverDirection direction); |
| 27 |
| 28 | // Returns true only if the direction will receive media. |
| 29 | bool RtpTransceiverDirectionHasRecv(RtpTransceiverDirection direction); |
| 30 |
| 31 | // Returns the RtpTransceiverDirection which is the reverse of the given |
| 32 | // direction. |
| 33 | RtpTransceiverDirection RtpTransceiverDirectionReversed( |
| 34 | RtpTransceiverDirection direction); |
| 35 |
| 36 | // Returns the RtpTransceiverDirection with its send component set to `send`. |
| 37 | RtpTransceiverDirection RtpTransceiverDirectionWithSendSet( |
| 38 | RtpTransceiverDirection direction, |
| 39 | bool send = true); |
| 40 |
| 41 | // Returns the RtpTransceiverDirection with its recv component set to `recv`. |
| 42 | RtpTransceiverDirection RtpTransceiverDirectionWithRecvSet( |
| 43 | RtpTransceiverDirection direction, |
| 44 | bool recv = true); |
| 45 |
| 46 | // Returns an unspecified string representation of the given direction. |
| 47 | const char* RtpTransceiverDirectionToString(RtpTransceiverDirection direction); |
| 48 |
| 49 | // Returns the intersection of the directions of two transceivers. |
| 50 | RtpTransceiverDirection RtpTransceiverDirectionIntersection( |
| 51 | RtpTransceiverDirection lhs, |
| 52 | RtpTransceiverDirection rhs); |
| 53 |
| 54 | #ifdef WEBRTC_UNIT_TEST |
| 55 | inline std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982) |
| 56 | std::ostream& os, // no-presubmit-check TODO(webrtc:8982) |
| 57 | RtpTransceiverDirection direction) { |
| 58 | return os << RtpTransceiverDirectionToString(direction); |
| 59 | } |
| 60 | #endif // WEBRTC_UNIT_TEST |
| 61 |
| 62 | } // namespace webrtc |
| 63 |
| 64 | #endif // PC_RTP_MEDIA_UTILS_H_ |
| 65 |