| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 std::string name; | 66 std::string name; |
| 67 int clockrate; | 67 int clockrate; |
| 68 CodecParameterMap params; | 68 CodecParameterMap params; |
| 69 FeedbackParams feedback_params; | 69 FeedbackParams feedback_params; |
| 70 | 70 |
| 71 // Creates a codec with the given parameters. | 71 // Creates a codec with the given parameters. |
| 72 Codec(int id, const std::string& name, int clockrate); | 72 Codec(int id, const std::string& name, int clockrate); |
| 73 // Creates an empty codec. | 73 // Creates an empty codec. |
| 74 Codec(); | 74 Codec(); |
| 75 Codec(const Codec& c); | 75 Codec(const Codec& c); |
| 76 ~Codec(); | 76 virtual ~Codec(); |
| 77 | 77 |
| 78 // Indicates if this codec is compatible with the specified codec. | 78 // Indicates if this codec is compatible with the specified codec. |
| 79 bool Matches(const Codec& codec) const; | 79 bool Matches(const Codec& codec) const; |
| 80 | 80 |
| 81 // Find the parameter for |name| and write the value to |out|. | 81 // Find the parameter for |name| and write the value to |out|. |
| 82 bool GetParam(const std::string& name, std::string* out) const; | 82 bool GetParam(const std::string& name, std::string* out) const; |
| 83 bool GetParam(const std::string& name, int* out) const; | 83 bool GetParam(const std::string& name, int* out) const; |
| 84 | 84 |
| 85 void SetParam(const std::string& name, const std::string& value); | 85 void SetParam(const std::string& name, const std::string& value); |
| 86 void SetParam(const std::string& name, int value); | 86 void SetParam(const std::string& name, int value); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 113 | 113 |
| 114 // Creates a codec with the given parameters. | 114 // Creates a codec with the given parameters. |
| 115 AudioCodec(int id, | 115 AudioCodec(int id, |
| 116 const std::string& name, | 116 const std::string& name, |
| 117 int clockrate, | 117 int clockrate, |
| 118 int bitrate, | 118 int bitrate, |
| 119 size_t channels); | 119 size_t channels); |
| 120 // Creates an empty codec. | 120 // Creates an empty codec. |
| 121 AudioCodec(); | 121 AudioCodec(); |
| 122 AudioCodec(const AudioCodec& c); | 122 AudioCodec(const AudioCodec& c); |
| 123 ~AudioCodec() = default; | 123 virtual ~AudioCodec() = default; |
| 124 | 124 |
| 125 // Indicates if this codec is compatible with the specified codec. | 125 // Indicates if this codec is compatible with the specified codec. |
| 126 bool Matches(const AudioCodec& codec) const; | 126 bool Matches(const AudioCodec& codec) const; |
| 127 | 127 |
| 128 std::string ToString() const; | 128 std::string ToString() const; |
| 129 | 129 |
| 130 webrtc::RtpCodecParameters ToCodecParameters() const override; | 130 webrtc::RtpCodecParameters ToCodecParameters() const override; |
| 131 | 131 |
| 132 AudioCodec& operator=(const AudioCodec& c); | 132 AudioCodec& operator=(const AudioCodec& c); |
| 133 | 133 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 146 // Creates a codec with the given parameters. | 146 // Creates a codec with the given parameters. |
| 147 VideoCodec(int id, | 147 VideoCodec(int id, |
| 148 const std::string& name, | 148 const std::string& name, |
| 149 int width, | 149 int width, |
| 150 int height, | 150 int height, |
| 151 int framerate); | 151 int framerate); |
| 152 VideoCodec(int id, const std::string& name); | 152 VideoCodec(int id, const std::string& name); |
| 153 // Creates an empty codec. | 153 // Creates an empty codec. |
| 154 VideoCodec(); | 154 VideoCodec(); |
| 155 VideoCodec(const VideoCodec& c); | 155 VideoCodec(const VideoCodec& c); |
| 156 ~VideoCodec() = default; | 156 virtual ~VideoCodec() = default; |
| 157 | 157 |
| 158 std::string ToString() const; | 158 std::string ToString() const; |
| 159 | 159 |
| 160 VideoCodec& operator=(const VideoCodec& c); | 160 VideoCodec& operator=(const VideoCodec& c); |
| 161 | 161 |
| 162 bool operator==(const VideoCodec& c) const; | 162 bool operator==(const VideoCodec& c) const; |
| 163 | 163 |
| 164 bool operator!=(const VideoCodec& c) const { | 164 bool operator!=(const VideoCodec& c) const { |
| 165 return !(*this == c); | 165 return !(*this == c); |
| 166 } | 166 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 179 // 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 |
| 180 // 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 |
| 181 // ValidateCodecFormat returns false. | 181 // ValidateCodecFormat returns false. |
| 182 bool ValidateCodecFormat() const; | 182 bool ValidateCodecFormat() const; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 struct DataCodec : public Codec { | 185 struct DataCodec : public Codec { |
| 186 DataCodec(int id, const std::string& name); | 186 DataCodec(int id, const std::string& name); |
| 187 DataCodec(); | 187 DataCodec(); |
| 188 DataCodec(const DataCodec& c); | 188 DataCodec(const DataCodec& c); |
| 189 virtual ~DataCodec() = default; |
| 189 | 190 |
| 190 DataCodec& operator=(const DataCodec& c); | 191 DataCodec& operator=(const DataCodec& c); |
| 191 | 192 |
| 192 std::string ToString() const; | 193 std::string ToString() const; |
| 193 }; | 194 }; |
| 194 | 195 |
| 195 // Get the codec setting associated with |payload_type|. If there | 196 // Get the codec setting associated with |payload_type|. If there |
| 196 // is no codec associated with that payload type it returns false. | 197 // is no codec associated with that payload type it returns false. |
| 197 template <class Codec> | 198 template <class Codec> |
| 198 bool FindCodecById(const std::vector<Codec>& codecs, | 199 bool FindCodecById(const std::vector<Codec>& codecs, |
| 199 int payload_type, | 200 int payload_type, |
| 200 Codec* codec_out) { | 201 Codec* codec_out) { |
| 201 for (const auto& codec : codecs) { | 202 for (const auto& codec : codecs) { |
| 202 if (codec.id == payload_type) { | 203 if (codec.id == payload_type) { |
| 203 *codec_out = codec; | 204 *codec_out = codec; |
| 204 return true; | 205 return true; |
| 205 } | 206 } |
| 206 } | 207 } |
| 207 return false; | 208 return false; |
| 208 } | 209 } |
| 209 | 210 |
| 210 bool CodecNamesEq(const std::string& name1, const std::string& name2); | 211 bool CodecNamesEq(const std::string& name1, const std::string& name2); |
| 211 bool HasNack(const Codec& codec); | 212 bool HasNack(const Codec& codec); |
| 212 bool HasRemb(const Codec& codec); | 213 bool HasRemb(const Codec& codec); |
| 213 bool HasTransportCc(const Codec& codec); | 214 bool HasTransportCc(const Codec& codec); |
| 214 | 215 |
| 215 } // namespace cricket | 216 } // namespace cricket |
| 216 | 217 |
| 217 #endif // WEBRTC_MEDIA_BASE_CODEC_H_ | 218 #endif // WEBRTC_MEDIA_BASE_CODEC_H_ |
| OLD | NEW |