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

Side by Side Diff: webrtc/pc/mediasession.h

Issue 1845673002: Removing `preference` field from `cricket::Codec`. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing sort order (got reversed when optimizations were made) Created 4 years, 8 months 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 | « webrtc/pc/channelmanager_unittest.cc ('k') | webrtc/pc/mediasession.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 * Copyright 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 StreamParamsVec streams_; 286 StreamParamsVec streams_;
287 bool conference_mode_ = false; 287 bool conference_mode_ = false;
288 bool partial_ = false; 288 bool partial_ = false;
289 int buffered_mode_latency_ = kBufferedModeDisabled; 289 int buffered_mode_latency_ = kBufferedModeDisabled;
290 MediaContentDirection direction_ = MD_SENDRECV; 290 MediaContentDirection direction_ = MD_SENDRECV;
291 }; 291 };
292 292
293 template <class C> 293 template <class C>
294 class MediaContentDescriptionImpl : public MediaContentDescription { 294 class MediaContentDescriptionImpl : public MediaContentDescription {
295 public: 295 public:
296 struct PreferenceSort { 296 typedef C CodecType;
297 bool operator()(C a, C b) { return a.preference > b.preference; }
298 };
299 297
298 // Codecs should be in preference order (most preferred codec first).
300 const std::vector<C>& codecs() const { return codecs_; } 299 const std::vector<C>& codecs() const { return codecs_; }
301 void set_codecs(const std::vector<C>& codecs) { codecs_ = codecs; } 300 void set_codecs(const std::vector<C>& codecs) { codecs_ = codecs; }
302 virtual bool has_codecs() const { return !codecs_.empty(); } 301 virtual bool has_codecs() const { return !codecs_.empty(); }
303 bool HasCodec(int id) { 302 bool HasCodec(int id) {
304 bool found = false; 303 bool found = false;
305 for (typename std::vector<C>::iterator iter = codecs_.begin(); 304 for (typename std::vector<C>::iterator iter = codecs_.begin();
306 iter != codecs_.end(); ++iter) { 305 iter != codecs_.end(); ++iter) {
307 if (iter->id == id) { 306 if (iter->id == id) {
308 found = true; 307 found = true;
309 break; 308 break;
(...skipping 13 matching lines...) Expand all
323 } 322 }
324 } 323 }
325 AddCodec(codec); 324 AddCodec(codec);
326 } 325 }
327 void AddCodecs(const std::vector<C>& codecs) { 326 void AddCodecs(const std::vector<C>& codecs) {
328 typename std::vector<C>::const_iterator codec; 327 typename std::vector<C>::const_iterator codec;
329 for (codec = codecs.begin(); codec != codecs.end(); ++codec) { 328 for (codec = codecs.begin(); codec != codecs.end(); ++codec) {
330 AddCodec(*codec); 329 AddCodec(*codec);
331 } 330 }
332 } 331 }
333 void SortCodecs() {
334 std::sort(codecs_.begin(), codecs_.end(), PreferenceSort());
335 }
336 332
337 private: 333 private:
338 std::vector<C> codecs_; 334 std::vector<C> codecs_;
339 }; 335 };
340 336
341 class AudioContentDescription : public MediaContentDescriptionImpl<AudioCodec> { 337 class AudioContentDescription : public MediaContentDescriptionImpl<AudioCodec> {
342 public: 338 public:
343 AudioContentDescription() : 339 AudioContentDescription() :
344 agc_minus_10db_(false) {} 340 agc_minus_10db_(false) {}
345 341
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 void GetSupportedVideoCryptoSuiteNames( 538 void GetSupportedVideoCryptoSuiteNames(
543 std::vector<std::string>* crypto_suite_names); 539 std::vector<std::string>* crypto_suite_names);
544 void GetSupportedDataCryptoSuiteNames( 540 void GetSupportedDataCryptoSuiteNames(
545 std::vector<std::string>* crypto_suite_names); 541 std::vector<std::string>* crypto_suite_names);
546 void GetDefaultSrtpCryptoSuiteNames( 542 void GetDefaultSrtpCryptoSuiteNames(
547 std::vector<std::string>* crypto_suite_names); 543 std::vector<std::string>* crypto_suite_names);
548 544
549 } // namespace cricket 545 } // namespace cricket
550 546
551 #endif // TALK_SESSION_MEDIA_MEDIASESSION_H_ 547 #endif // TALK_SESSION_MEDIA_MEDIASESSION_H_
OLDNEW
« no previous file with comments | « webrtc/pc/channelmanager_unittest.cc ('k') | webrtc/pc/mediasession.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698