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

Unified Diff: webrtc/api/webrtcsdp.cc

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 | « no previous file | webrtc/media/base/codec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/webrtcsdp.cc
diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc
index b7ef28e38d421c554fb8908dbeccb3ab0ac30138..d78112c1680e86ed1b6b20d9105ca6a48a3dd74e 100644
--- a/webrtc/api/webrtcsdp.cc
+++ b/webrtc/api/webrtcsdp.cc
@@ -2438,10 +2438,12 @@ void AddFeedbackParameters(const cricket::FeedbackParams& feedback_params,
// with that payload type.
template <class T>
T GetCodecWithPayloadType(const std::vector<T>& codecs, int payload_type) {
+ const T* codec = FindCodecById(codecs, payload_type);
+ if (codec)
+ return *codec;
+ // Return empty codec with |payload_type|.
T ret_val;
- if (!FindCodecById(codecs, payload_type, &ret_val)) {
- ret_val.id = payload_type;
- }
+ ret_val.id = payload_type;
return ret_val;
}
« no previous file with comments | « no previous file | webrtc/media/base/codec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698