tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rid_description.h (4456B)


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