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

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: comments addressed. 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
« no previous file with comments | « talk/media/webrtc/webrtcmediaengine.h ('k') | talk/media/webrtc/webrtcvideoengine2.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 * 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 const char* kBweExtensionPriorities[] = {
72 kRtpTransportSequenceNumberHeaderExtension,
73 kRtpAbsoluteSenderTimeHeaderExtension, kRtpTimestampOffsetHeaderExtension};
74
75 const size_t kBweExtensionPrioritiesLength = sizeof(kBweExtensionPriorities);
pbos-webrtc 2015/10/29 15:36:04 = ARRAY_SIZE(kBweExtensionPriorities), this is now
stefan-webrtc 2015/10/29 15:37:35 Done.
76
77 int GetPriority(const RtpHeaderExtension& extension,
78 const char* extension_prios[],
79 size_t extension_prios_length) {
80 for (size_t i = 0; i < extension_prios_length; ++i) {
81 if (extension.uri == extension_prios[i])
82 return i;
83 }
84 return -1;
85 }
86
87 std::vector<RtpHeaderExtension> FilterRedundantRtpExtensions(
88 const std::vector<RtpHeaderExtension>& extensions,
89 const char* extension_prios[],
90 size_t extension_prios_length) {
91 if (extensions.empty())
92 return std::vector<RtpHeaderExtension>();
93 std::vector<RtpHeaderExtension> filtered;
94 std::map<int, const RtpHeaderExtension*> sorted;
95 for (auto& extension : extensions) {
96 int priority =
97 GetPriority(extension, extension_prios, extension_prios_length);
98 if (priority == -1) {
99 filtered.push_back(extension);
100 continue;
101 } else {
102 sorted[priority] = &extension;
103 }
104 }
105 if (!sorted.empty())
106 filtered.push_back(*sorted.begin()->second);
107 return filtered;
108 }
109
71 } // namespace cricket 110 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcmediaengine.h ('k') | talk/media/webrtc/webrtcvideoengine2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698