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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/webrtcsdp.cc ('k') | webrtc/media/base/rtpdataengine.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/codec.h
diff --git a/webrtc/media/base/codec.h b/webrtc/media/base/codec.h
index bfbff23c9416e336a303d90c2d11b60b943e3f05..3bd93a92472c3384f41f95205b67605405f09974 100644
--- a/webrtc/media/base/codec.h
+++ b/webrtc/media/base/codec.h
@@ -197,18 +197,14 @@ struct DataCodec : public Codec {
};
// Get the codec setting associated with |payload_type|. If there
-// is no codec associated with that payload type it returns false.
+// is no codec associated with that payload type it returns nullptr.
template <class Codec>
-bool FindCodecById(const std::vector<Codec>& codecs,
- int payload_type,
- Codec* codec_out) {
+const Codec* FindCodecById(const std::vector<Codec>& codecs, int payload_type) {
for (const auto& codec : codecs) {
- if (codec.id == payload_type) {
- *codec_out = codec;
- return true;
- }
+ if (codec.id == payload_type)
+ return &codec;
}
- return false;
+ return nullptr;
}
bool CodecNamesEq(const std::string& name1, const std::string& name2);
« 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