Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: webrtc/media/base/codec.h

Issue 2493733003: Optimize FindCodecById and ReferencedCodecsMatch (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/webrtcsdp.cc ('k') | webrtc/media/base/rtpdataengine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 DataCodec(DataCodec&& c); 190 DataCodec(DataCodec&& c);
191 virtual ~DataCodec() = default; 191 virtual ~DataCodec() = default;
192 192
193 DataCodec& operator=(const DataCodec& c); 193 DataCodec& operator=(const DataCodec& c);
194 DataCodec& operator=(DataCodec&& c); 194 DataCodec& operator=(DataCodec&& c);
195 195
196 std::string ToString() const; 196 std::string ToString() const;
197 }; 197 };
198 198
199 // Get the codec setting associated with |payload_type|. If there 199 // Get the codec setting associated with |payload_type|. If there
200 // is no codec associated with that payload type it returns false. 200 // is no codec associated with that payload type it returns nullptr.
201 template <class Codec> 201 template <class Codec>
202 bool FindCodecById(const std::vector<Codec>& codecs, 202 const Codec* FindCodecById(const std::vector<Codec>& codecs, int payload_type) {
203 int payload_type,
204 Codec* codec_out) {
205 for (const auto& codec : codecs) { 203 for (const auto& codec : codecs) {
206 if (codec.id == payload_type) { 204 if (codec.id == payload_type)
207 *codec_out = codec; 205 return &codec;
208 return true;
209 }
210 } 206 }
211 return false; 207 return nullptr;
212 } 208 }
213 209
214 bool CodecNamesEq(const std::string& name1, const std::string& name2); 210 bool CodecNamesEq(const std::string& name1, const std::string& name2);
215 bool CodecNamesEq(const char* name1, const char* name2); 211 bool CodecNamesEq(const char* name1, const char* name2);
216 webrtc::VideoCodecType CodecTypeFromName(const std::string& name); 212 webrtc::VideoCodecType CodecTypeFromName(const std::string& name);
217 bool HasNack(const Codec& codec); 213 bool HasNack(const Codec& codec);
218 bool HasRemb(const Codec& codec); 214 bool HasRemb(const Codec& codec);
219 bool HasTransportCc(const Codec& codec); 215 bool HasTransportCc(const Codec& codec);
220 bool IsCodecSupported(const std::vector<VideoCodec>& supported_codecs, 216 bool IsCodecSupported(const std::vector<VideoCodec>& supported_codecs,
221 const VideoCodec& codec); 217 const VideoCodec& codec);
222 218
223 } // namespace cricket 219 } // namespace cricket
224 220
225 #endif // WEBRTC_MEDIA_BASE_CODEC_H_ 221 #endif // WEBRTC_MEDIA_BASE_CODEC_H_
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsdp.cc ('k') | webrtc/media/base/rtpdataengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698