| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 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 | 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 | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 67   std::string name; | 67   std::string name; | 
| 68   int clockrate; | 68   int clockrate; | 
| 69   CodecParameterMap params; | 69   CodecParameterMap params; | 
| 70   FeedbackParams feedback_params; | 70   FeedbackParams feedback_params; | 
| 71 | 71 | 
| 72   // Creates a codec with the given parameters. | 72   // Creates a codec with the given parameters. | 
| 73   Codec(int id, const std::string& name, int clockrate); | 73   Codec(int id, const std::string& name, int clockrate); | 
| 74   // Creates an empty codec. | 74   // Creates an empty codec. | 
| 75   Codec(); | 75   Codec(); | 
| 76   Codec(const Codec& c); | 76   Codec(const Codec& c); | 
|  | 77   Codec(Codec&& c); | 
| 77   virtual ~Codec(); | 78   virtual ~Codec(); | 
| 78 | 79 | 
| 79   // Indicates if this codec is compatible with the specified codec. | 80   // Indicates if this codec is compatible with the specified codec. | 
| 80   bool Matches(const Codec& codec) const; | 81   bool Matches(const Codec& codec) const; | 
| 81 | 82 | 
| 82   // Find the parameter for |name| and write the value to |out|. | 83   // Find the parameter for |name| and write the value to |out|. | 
| 83   bool GetParam(const std::string& name, std::string* out) const; | 84   bool GetParam(const std::string& name, std::string* out) const; | 
| 84   bool GetParam(const std::string& name, int* out) const; | 85   bool GetParam(const std::string& name, int* out) const; | 
| 85 | 86 | 
| 86   void SetParam(const std::string& name, const std::string& value); | 87   void SetParam(const std::string& name, const std::string& value); | 
| 87   void SetParam(const std::string& name, int value); | 88   void SetParam(const std::string& name, int value); | 
| 88 | 89 | 
| 89   // It is safe to input a non-existent parameter. | 90   // It is safe to input a non-existent parameter. | 
| 90   // Returns true if the parameter existed, false if it did not exist. | 91   // Returns true if the parameter existed, false if it did not exist. | 
| 91   bool RemoveParam(const std::string& name); | 92   bool RemoveParam(const std::string& name); | 
| 92 | 93 | 
| 93   bool HasFeedbackParam(const FeedbackParam& param) const; | 94   bool HasFeedbackParam(const FeedbackParam& param) const; | 
| 94   void AddFeedbackParam(const FeedbackParam& param); | 95   void AddFeedbackParam(const FeedbackParam& param); | 
| 95 | 96 | 
| 96   // Filter |this| feedbacks params such that only those shared by both |this| | 97   // Filter |this| feedbacks params such that only those shared by both |this| | 
| 97   // and |other| are kept. | 98   // and |other| are kept. | 
| 98   void IntersectFeedbackParams(const Codec& other); | 99   void IntersectFeedbackParams(const Codec& other); | 
| 99 | 100 | 
| 100   virtual webrtc::RtpCodecParameters ToCodecParameters() const; | 101   virtual webrtc::RtpCodecParameters ToCodecParameters() const; | 
| 101 | 102 | 
| 102   Codec& operator=(const Codec& c); | 103   Codec& operator=(const Codec& c); | 
|  | 104   Codec& operator=(Codec&& c); | 
| 103 | 105 | 
| 104   bool operator==(const Codec& c) const; | 106   bool operator==(const Codec& c) const; | 
| 105 | 107 | 
| 106   bool operator!=(const Codec& c) const { | 108   bool operator!=(const Codec& c) const { | 
| 107     return !(*this == c); | 109     return !(*this == c); | 
| 108   } | 110   } | 
| 109 }; | 111 }; | 
| 110 | 112 | 
| 111 struct AudioCodec : public Codec { | 113 struct AudioCodec : public Codec { | 
| 112   int bitrate; | 114   int bitrate; | 
| 113   size_t channels; | 115   size_t channels; | 
| 114 | 116 | 
| 115   // Creates a codec with the given parameters. | 117   // Creates a codec with the given parameters. | 
| 116   AudioCodec(int id, | 118   AudioCodec(int id, | 
| 117              const std::string& name, | 119              const std::string& name, | 
| 118              int clockrate, | 120              int clockrate, | 
| 119              int bitrate, | 121              int bitrate, | 
| 120              size_t channels); | 122              size_t channels); | 
| 121   // Creates an empty codec. | 123   // Creates an empty codec. | 
| 122   AudioCodec(); | 124   AudioCodec(); | 
| 123   AudioCodec(const AudioCodec& c); | 125   AudioCodec(const AudioCodec& c); | 
|  | 126   AudioCodec(AudioCodec&& c); | 
| 124   virtual ~AudioCodec() = default; | 127   virtual ~AudioCodec() = default; | 
| 125 | 128 | 
| 126   // Indicates if this codec is compatible with the specified codec. | 129   // Indicates if this codec is compatible with the specified codec. | 
| 127   bool Matches(const AudioCodec& codec) const; | 130   bool Matches(const AudioCodec& codec) const; | 
| 128 | 131 | 
| 129   std::string ToString() const; | 132   std::string ToString() const; | 
| 130 | 133 | 
| 131   webrtc::RtpCodecParameters ToCodecParameters() const override; | 134   webrtc::RtpCodecParameters ToCodecParameters() const override; | 
| 132 | 135 | 
| 133   AudioCodec& operator=(const AudioCodec& c); | 136   AudioCodec& operator=(const AudioCodec& c); | 
|  | 137   AudioCodec& operator=(AudioCodec&& c); | 
| 134 | 138 | 
| 135   bool operator==(const AudioCodec& c) const; | 139   bool operator==(const AudioCodec& c) const; | 
| 136 | 140 | 
| 137   bool operator!=(const AudioCodec& c) const { | 141   bool operator!=(const AudioCodec& c) const { | 
| 138     return !(*this == c); | 142     return !(*this == c); | 
| 139   } | 143   } | 
| 140 }; | 144 }; | 
| 141 | 145 | 
| 142 struct VideoCodec : public Codec { | 146 struct VideoCodec : public Codec { | 
| 143   // Creates a codec with the given parameters. | 147   // Creates a codec with the given parameters. | 
| 144   VideoCodec(int id, const std::string& name); | 148   VideoCodec(int id, const std::string& name); | 
| 145   // Creates a codec with the given name and empty id. | 149   // Creates a codec with the given name and empty id. | 
| 146   explicit VideoCodec(const std::string& name); | 150   explicit VideoCodec(const std::string& name); | 
| 147   // Creates an empty codec. | 151   // Creates an empty codec. | 
| 148   VideoCodec(); | 152   VideoCodec(); | 
| 149   VideoCodec(const VideoCodec& c); | 153   VideoCodec(const VideoCodec& c); | 
|  | 154   VideoCodec(VideoCodec&& c); | 
| 150   virtual ~VideoCodec() = default; | 155   virtual ~VideoCodec() = default; | 
| 151 | 156 | 
| 152   std::string ToString() const; | 157   std::string ToString() const; | 
| 153 | 158 | 
| 154   VideoCodec& operator=(const VideoCodec& c); | 159   VideoCodec& operator=(const VideoCodec& c); | 
|  | 160   VideoCodec& operator=(VideoCodec&& c); | 
| 155 | 161 | 
| 156   bool operator==(const VideoCodec& c) const; | 162   bool operator==(const VideoCodec& c) const; | 
| 157 | 163 | 
| 158   bool operator!=(const VideoCodec& c) const { | 164   bool operator!=(const VideoCodec& c) const { | 
| 159     return !(*this == c); | 165     return !(*this == c); | 
| 160   } | 166   } | 
| 161 | 167 | 
| 162   static VideoCodec CreateRtxCodec(int rtx_payload_type, | 168   static VideoCodec CreateRtxCodec(int rtx_payload_type, | 
| 163                                    int associated_payload_type); | 169                                    int associated_payload_type); | 
| 164 | 170 | 
| 165   enum CodecType { | 171   enum CodecType { | 
| 166     CODEC_VIDEO, | 172     CODEC_VIDEO, | 
| 167     CODEC_RED, | 173     CODEC_RED, | 
| 168     CODEC_ULPFEC, | 174     CODEC_ULPFEC, | 
| 169     CODEC_RTX, | 175     CODEC_RTX, | 
| 170   }; | 176   }; | 
| 171 | 177 | 
| 172   CodecType GetCodecType() const; | 178   CodecType GetCodecType() const; | 
| 173   // Validates a VideoCodec's payload type, dimensions and bitrates etc. If they | 179   // Validates a VideoCodec's payload type, dimensions and bitrates etc. If they | 
| 174   // don't make sense (such as max < min bitrate), and error is logged and | 180   // don't make sense (such as max < min bitrate), and error is logged and | 
| 175   // ValidateCodecFormat returns false. | 181   // ValidateCodecFormat returns false. | 
| 176   bool ValidateCodecFormat() const; | 182   bool ValidateCodecFormat() const; | 
| 177 }; | 183 }; | 
| 178 | 184 | 
| 179 struct DataCodec : public Codec { | 185 struct DataCodec : public Codec { | 
| 180   DataCodec(int id, const std::string& name); | 186   DataCodec(int id, const std::string& name); | 
| 181   DataCodec(); | 187   DataCodec(); | 
| 182   DataCodec(const DataCodec& c); | 188   DataCodec(const DataCodec& c); | 
|  | 189   DataCodec(DataCodec&& c); | 
| 183   virtual ~DataCodec() = default; | 190   virtual ~DataCodec() = default; | 
| 184 | 191 | 
| 185   DataCodec& operator=(const DataCodec& c); | 192   DataCodec& operator=(const DataCodec& c); | 
|  | 193   DataCodec& operator=(DataCodec&& c); | 
| 186 | 194 | 
| 187   std::string ToString() const; | 195   std::string ToString() const; | 
| 188 }; | 196 }; | 
| 189 | 197 | 
| 190 // Get the codec setting associated with |payload_type|. If there | 198 // Get the codec setting associated with |payload_type|. If there | 
| 191 // is no codec associated with that payload type it returns false. | 199 // is no codec associated with that payload type it returns false. | 
| 192 template <class Codec> | 200 template <class Codec> | 
| 193 bool FindCodecById(const std::vector<Codec>& codecs, | 201 bool FindCodecById(const std::vector<Codec>& codecs, | 
| 194                    int payload_type, | 202                    int payload_type, | 
| 195                    Codec* codec_out) { | 203                    Codec* codec_out) { | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 207 webrtc::VideoCodecType CodecTypeFromName(const std::string& name); | 215 webrtc::VideoCodecType CodecTypeFromName(const std::string& name); | 
| 208 bool HasNack(const Codec& codec); | 216 bool HasNack(const Codec& codec); | 
| 209 bool HasRemb(const Codec& codec); | 217 bool HasRemb(const Codec& codec); | 
| 210 bool HasTransportCc(const Codec& codec); | 218 bool HasTransportCc(const Codec& codec); | 
| 211 bool IsCodecSupported(const std::vector<VideoCodec>& supported_codecs, | 219 bool IsCodecSupported(const std::vector<VideoCodec>& supported_codecs, | 
| 212                       const VideoCodec& codec); | 220                       const VideoCodec& codec); | 
| 213 | 221 | 
| 214 }  // namespace cricket | 222 }  // namespace cricket | 
| 215 | 223 | 
| 216 #endif  // WEBRTC_MEDIA_BASE_CODEC_H_ | 224 #endif  // WEBRTC_MEDIA_BASE_CODEC_H_ | 
| OLD | NEW | 
|---|