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

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: size_t conversion fix 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 =
76 ARRAY_SIZE(kBweExtensionPriorities);
77
78 int GetPriority(const RtpHeaderExtension& extension,
79 const char* extension_prios[],
80 size_t extension_prios_length) {
81 for (size_t i = 0; i < extension_prios_length; ++i) {
82 if (extension.uri == extension_prios[i])
83 return static_cast<int>(i);
84 }
85 return -1;
86 }
87
88 std::vector<RtpHeaderExtension> FilterRedundantRtpExtensions(
89 const std::vector<RtpHeaderExtension>& extensions,
90 const char* extension_prios[],
91 size_t extension_prios_length) {
92 if (extensions.empty())
93 return std::vector<RtpHeaderExtension>();
94 std::vector<RtpHeaderExtension> filtered;
95 std::map<int, const RtpHeaderExtension*> sorted;
96 for (auto& extension : extensions) {
97 int priority =
98 GetPriority(extension, extension_prios, extension_prios_length);
99 if (priority == -1) {
100 filtered.push_back(extension);
101 continue;
102 } else {
103 sorted[priority] = &extension;
104 }
105 }
106 if (!sorted.empty())
107 filtered.push_back(*sorted.begin()->second);
108 return filtered;
109 }
110
71 } // namespace cricket 111 } // 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