OLD | NEW |
---|---|
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 Loading... | |
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 |
OLD | NEW |