| 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 MEDIA_BASE_RID_DESCRIPTION_H_ |
| 12 | #define MEDIA_BASE_RID_DESCRIPTION_H_ |
| 13 |
| 14 | #include <map> |
| 15 | #include <string> |
| 16 | #include <vector> |
| 17 |
| 18 | namespace cricket { |
| 19 |
| 20 | enum class RidDirection { kSend, kReceive }; |
| 21 |
| 22 | // Description of a Restriction Id (RID) according to: |
| 23 | // https://tools.ietf.org/html/draft-ietf-mmusic-rid-15 |
| 24 | // A Restriction Identifier serves two purposes: |
| 25 | // 1. Uniquely identifies an RTP stream inside an RTP session. |
| 26 | // When combined with MIDs (https://tools.ietf.org/html/rfc5888), |
| 27 | // RIDs uniquely identify an RTP stream within an RTP session. |
| 28 | // The MID will identify the media section and the RID will identify |
| 29 | // the stream within the section. |
| 30 | // RID identifiers must be unique within the media section. |
| 31 | // 2. Allows indicating further restrictions to the stream. |
| 32 | // These restrictions are added according to the direction specified. |
| 33 | // The direction field identifies the direction of the RTP stream packets |
| 34 | // to which the restrictions apply. The direction is independent of the |
| 35 | // transceiver direction and can be one of {send, recv}. |
| 36 | // The following are some examples of these restrictions: |
| 37 | // a. max-width, max-height, max-fps, max-br, ... |
| 38 | // b. further restricting the codec set (from what m= section specified) |
| 39 | // |
| 40 | // Note: Indicating dependencies between streams (using depend) will not be |
| 41 | // supported, since the WG is adopting a different approach to achieve this. |
| 42 | // As of 2018-12-04, the new SVC (Scalable Video Coder) approach is still not |
| 43 | // mature enough to be implemented as part of this work. |
| 44 | // See: https://w3c.github.io/webrtc-svc/ for more details. |
| 45 | struct RidDescription final { |
| 46 | RidDescription(); |
| 47 | RidDescription(const std::string& rid, RidDirection direction); |
| 48 | RidDescription(const RidDescription& other); |
| 49 | ~RidDescription(); |
| 50 | RidDescription& operator=(const RidDescription& other); |
| 51 |
| 52 | // This is currently required for unit tests of StreamParams which contains |
| 53 | // RidDescription objects and checks for equality using operator==. |
| 54 | bool operator==(const RidDescription& other) const; |
| 55 | bool operator!=(const RidDescription& other) const { |
| 56 | return !(*this == other); |
| 57 | } |
| 58 |
| 59 | // The RID identifier that uniquely identifies the stream within the session. |
| 60 | std::string rid; |
| 61 |
| 62 | // Specifies the direction for which the specified restrictions hold. |
| 63 | // This direction is either send or receive and is independent of the |
| 64 | // direction of the transceiver. |
| 65 | // https://tools.ietf.org/html/draft-ietf-mmusic-rid-15#section-4 : |
| 66 | // The "direction" field identifies the direction of the RTP Stream |
| 67 | // packets to which the indicated restrictions are applied. It may be |
| 68 | // either "send" or "recv". Note that these restriction directions are |
| 69 | // expressed independently of any "inactive", "sendonly", "recvonly", or |
| 70 | // "sendrecv" attributes associated with the media section. It is, for |
| 71 | // example, valid to indicate "recv" restrictions on a "sendonly" |
| 72 | // stream; those restrictions would apply if, at a future point in time, |
| 73 | // the stream were changed to "sendrecv" or "recvonly". |
| 74 | RidDirection direction; |
| 75 |
| 76 | // The list of codec payload types for this stream. |
| 77 | // It should be a subset of the payloads supported for the media section. |
| 78 | std::vector<int> payload_types; |
| 79 |
| 80 | // Contains key-value pairs for restrictions. |
| 81 | // The keys are not validated against a known set. |
| 82 | // The meaning to infer for the values depends on each key. |
| 83 | // Examples: |
| 84 | // 1. An entry for max-width will have a value that is interpreted as an int. |
| 85 | // 2. An entry for max-bpp (bits per pixel) will have a float value. |
| 86 | // Interpretation (and validation of value) is left for the implementation. |
| 87 | // I.E. the media engines should validate values for parameters they support. |
| 88 | std::map<std::string, std::string> restrictions; |
| 89 | }; |
| 90 |
| 91 | } // namespace cricket |
| 92 |
| 93 | #endif // MEDIA_BASE_RID_DESCRIPTION_H_ |
| 94 |