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

Side by Side Diff: talk/media/webrtc/webrtcmediaengine.cc

Issue 1429753003: Filter overlapping RTP header extensions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: . Created 5 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Used by PeerConnectionFactory to create a media engine passed into 62 // Used by PeerConnectionFactory to create a media engine passed into
63 // ChannelManager. 63 // ChannelManager.
64 MediaEngineInterface* WebRtcMediaEngineFactory::Create( 64 MediaEngineInterface* WebRtcMediaEngineFactory::Create(
65 webrtc::AudioDeviceModule* adm, 65 webrtc::AudioDeviceModule* adm,
66 WebRtcVideoEncoderFactory* encoder_factory, 66 WebRtcVideoEncoderFactory* encoder_factory,
67 WebRtcVideoDecoderFactory* decoder_factory) { 67 WebRtcVideoDecoderFactory* decoder_factory) {
68 return CreateWebRtcMediaEngine(adm, encoder_factory, decoder_factory); 68 return CreateWebRtcMediaEngine(adm, encoder_factory, decoder_factory);
69 } 69 }
70 70
71 static const std::map<std::string, int> CreateBweExtensionPriorities() {
72 std::map<std::string, int> extension_prios;
73 extension_prios[kRtpTransportSequenceNumberHeaderExtension] = 0;
74 extension_prios[kRtpAbsoluteSenderTimeHeaderExtension] = 1;
75 extension_prios[kRtpTimestampOffsetHeaderExtension] = 2;
76 return extension_prios;
77 }
78 const std::map<std::string, int> kBweExtensionPriorities =
79 CreateBweExtensionPriorities();
pbos-webrtc 2015/10/29 14:16:22 Static initializer, not permitted. Can you make th
stefan-webrtc 2015/10/29 14:51:11 Done.
80
81 std::vector<RtpHeaderExtension> FilterOverlappingRtpExtensions(
82 const std::vector<RtpHeaderExtension>& extensions,
83 const std::map<std::string, int>& extension_prios) {
84 if (extensions.empty())
85 return std::vector<RtpHeaderExtension>();
86 std::vector<RtpHeaderExtension> filtered;
87 std::map<int, const RtpHeaderExtension*> sorted;
88 for (auto& extension : extensions) {
89 auto it = extension_prios.find(extension.uri);
90 if (it == extension_prios.end()) {
91 filtered.push_back(extension);
92 continue;
93 } else {
94 sorted[it->second] = &extension;
95 }
96 }
97 if (!sorted.empty())
98 filtered.push_back(*sorted.begin()->second);
99 return filtered;
100 }
101
71 } // namespace cricket 102 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698