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 |
11 #ifndef WEBRTC_MEDIA_BASE_CODEC_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_CODEC_H_ |
12 #define WEBRTC_MEDIA_BASE_CODEC_H_ | 12 #define WEBRTC_MEDIA_BASE_CODEC_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <set> | 15 #include <set> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/api/rtpparameters.h" | 19 #include "webrtc/api/rtpparameters.h" |
20 #include "webrtc/common_types.h" | 20 #include "webrtc/common_types.h" |
21 #include "webrtc/media/base/mediaconstants.h" | 21 #include "webrtc/media/base/mediaconstants.h" |
22 | 22 |
23 namespace cricket { | 23 namespace cricket { |
24 | 24 |
25 typedef std::map<std::string, std::string> CodecParameterMap; | 25 typedef std::map<std::string, std::string> CodecParameterMap; |
26 | 26 |
27 extern const int kMaxPayloadId; | |
28 | |
29 class FeedbackParam { | 27 class FeedbackParam { |
30 public: | 28 public: |
31 FeedbackParam(const std::string& id, const std::string& param) | 29 FeedbackParam(const std::string& id, const std::string& param) |
32 : id_(id), | 30 : id_(id), |
33 param_(param) { | 31 param_(param) { |
34 } | 32 } |
35 explicit FeedbackParam(const std::string& id) | 33 explicit FeedbackParam(const std::string& id) |
36 : id_(id), | 34 : id_(id), |
37 param_(kParamValueEmpty) { | 35 param_(kParamValueEmpty) { |
38 } | 36 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // Creates a codec with the given parameters. | 145 // Creates a codec with the given parameters. |
148 VideoCodec(int id, const std::string& name); | 146 VideoCodec(int id, const std::string& name); |
149 // Creates a codec with the given name and empty id. | 147 // Creates a codec with the given name and empty id. |
150 explicit VideoCodec(const std::string& name); | 148 explicit VideoCodec(const std::string& name); |
151 // Creates an empty codec. | 149 // Creates an empty codec. |
152 VideoCodec(); | 150 VideoCodec(); |
153 VideoCodec(const VideoCodec& c); | 151 VideoCodec(const VideoCodec& c); |
154 VideoCodec(VideoCodec&& c); | 152 VideoCodec(VideoCodec&& c); |
155 virtual ~VideoCodec() = default; | 153 virtual ~VideoCodec() = default; |
156 | 154 |
| 155 // Indicates if this video codec is the same as the other video codec, e.g. if |
| 156 // they are both VP8 or VP9, or if they are both H264 with the same H264 |
| 157 // profile. H264 levels however are not compared. |
| 158 bool Matches(const VideoCodec& codec) const; |
| 159 |
157 std::string ToString() const; | 160 std::string ToString() const; |
158 | 161 |
159 VideoCodec& operator=(const VideoCodec& c); | 162 VideoCodec& operator=(const VideoCodec& c); |
160 VideoCodec& operator=(VideoCodec&& c); | 163 VideoCodec& operator=(VideoCodec&& c); |
161 | 164 |
162 bool operator==(const VideoCodec& c) const; | 165 bool operator==(const VideoCodec& c) const; |
163 | 166 |
164 bool operator!=(const VideoCodec& c) const { | 167 bool operator!=(const VideoCodec& c) const { |
165 return !(*this == c); | 168 return !(*this == c); |
166 } | 169 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 209 } |
207 return nullptr; | 210 return nullptr; |
208 } | 211 } |
209 | 212 |
210 bool CodecNamesEq(const std::string& name1, const std::string& name2); | 213 bool CodecNamesEq(const std::string& name1, const std::string& name2); |
211 bool CodecNamesEq(const char* name1, const char* name2); | 214 bool CodecNamesEq(const char* name1, const char* name2); |
212 webrtc::VideoCodecType CodecTypeFromName(const std::string& name); | 215 webrtc::VideoCodecType CodecTypeFromName(const std::string& name); |
213 bool HasNack(const Codec& codec); | 216 bool HasNack(const Codec& codec); |
214 bool HasRemb(const Codec& codec); | 217 bool HasRemb(const Codec& codec); |
215 bool HasTransportCc(const Codec& codec); | 218 bool HasTransportCc(const Codec& codec); |
216 bool IsCodecSupported(const std::vector<VideoCodec>& supported_codecs, | 219 // Returns the first codec in |supported_codecs| that matches |codec|, or |
217 const VideoCodec& codec); | 220 // nullptr if no codec matches. |
| 221 const VideoCodec* FindMatchingCodec( |
| 222 const std::vector<VideoCodec>& supported_codecs, |
| 223 const VideoCodec& codec); |
218 | 224 |
219 } // namespace cricket | 225 } // namespace cricket |
220 | 226 |
221 #endif // WEBRTC_MEDIA_BASE_CODEC_H_ | 227 #endif // WEBRTC_MEDIA_BASE_CODEC_H_ |
OLD | NEW |