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

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

Issue 1486123002: Return a copy of the supported RTP header extensions instead of a reference. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments addressed. Created 5 years 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 2004 Google Inc. 3 * Copyright 2004 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 504
505 signal_thread_checker_.DetachFromThread(); 505 signal_thread_checker_.DetachFromThread();
506 std::memset(&default_agc_config_, 0, sizeof(default_agc_config_)); 506 std::memset(&default_agc_config_, 0, sizeof(default_agc_config_));
507 507
508 webrtc::Trace::set_level_filter(kDefaultTraceFilter); 508 webrtc::Trace::set_level_filter(kDefaultTraceFilter);
509 webrtc::Trace::SetTraceCallback(this); 509 webrtc::Trace::SetTraceCallback(this);
510 510
511 // Load our audio codec list. 511 // Load our audio codec list.
512 codecs_ = WebRtcVoiceCodecs::SupportedCodecs(); 512 codecs_ = WebRtcVoiceCodecs::SupportedCodecs();
513 513
514 // Load our RTP Header extensions.
515 rtp_header_extensions_.push_back(
516 RtpHeaderExtension(kRtpAudioLevelHeaderExtension,
517 kRtpAudioLevelHeaderExtensionDefaultId));
518 rtp_header_extensions_.push_back(
519 RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension,
520 kRtpAbsoluteSenderTimeHeaderExtensionDefaultId));
521 if (webrtc::field_trial::FindFullName("WebRTC-SendSideBwe") == "Enabled") {
522 rtp_header_extensions_.push_back(RtpHeaderExtension(
523 kRtpTransportSequenceNumberHeaderExtension,
524 kRtpTransportSequenceNumberHeaderExtensionDefaultId));
525 }
526 options_ = GetDefaultEngineOptions(); 514 options_ = GetDefaultEngineOptions();
527 } 515 }
528 516
529 WebRtcVoiceEngine::~WebRtcVoiceEngine() { 517 WebRtcVoiceEngine::~WebRtcVoiceEngine() {
530 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 518 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
531 LOG(LS_VERBOSE) << "WebRtcVoiceEngine::~WebRtcVoiceEngine"; 519 LOG(LS_VERBOSE) << "WebRtcVoiceEngine::~WebRtcVoiceEngine";
532 if (adm_) { 520 if (adm_) {
533 voe_wrapper_.reset(); 521 voe_wrapper_.reset();
534 adm_->Release(); 522 adm_->Release();
535 adm_ = NULL; 523 adm_ = NULL;
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 unsigned int ulevel; 1055 unsigned int ulevel;
1068 return (voe_wrapper_->volume()->GetSpeechInputLevel(ulevel) != -1) ? 1056 return (voe_wrapper_->volume()->GetSpeechInputLevel(ulevel) != -1) ?
1069 static_cast<int>(ulevel) : -1; 1057 static_cast<int>(ulevel) : -1;
1070 } 1058 }
1071 1059
1072 const std::vector<AudioCodec>& WebRtcVoiceEngine::codecs() { 1060 const std::vector<AudioCodec>& WebRtcVoiceEngine::codecs() {
1073 RTC_DCHECK(signal_thread_checker_.CalledOnValidThread()); 1061 RTC_DCHECK(signal_thread_checker_.CalledOnValidThread());
1074 return codecs_; 1062 return codecs_;
1075 } 1063 }
1076 1064
1077 const std::vector<RtpHeaderExtension>& 1065 RtpCapabilities
1078 WebRtcVoiceEngine::rtp_header_extensions() const { 1066 WebRtcVoiceEngine::GetCapabilities() const {
1079 RTC_DCHECK(signal_thread_checker_.CalledOnValidThread()); 1067 RTC_DCHECK(signal_thread_checker_.CalledOnValidThread());
1080 return rtp_header_extensions_; 1068 RtpCapabilities capabilities;
1069 capabilities.header_extensions.push_back(RtpHeaderExtension(
1070 kRtpAudioLevelHeaderExtension, kRtpAudioLevelHeaderExtensionDefaultId));
1071 capabilities.header_extensions.push_back(
1072 RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension,
1073 kRtpAbsoluteSenderTimeHeaderExtensionDefaultId));
1074 if (webrtc::field_trial::FindFullName("WebRTC-SendSideBwe") == "Enabled") {
1075 capabilities.header_extensions.push_back(RtpHeaderExtension(
1076 kRtpTransportSequenceNumberHeaderExtension,
1077 kRtpTransportSequenceNumberHeaderExtensionDefaultId));
1078 }
1079 return capabilities;
1081 } 1080 }
1082 1081
1083 int WebRtcVoiceEngine::GetLastEngineError() { 1082 int WebRtcVoiceEngine::GetLastEngineError() {
1084 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1083 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1085 return voe_wrapper_->error(); 1084 return voe_wrapper_->error();
1086 } 1085 }
1087 1086
1088 void WebRtcVoiceEngine::Print(webrtc::TraceLevel level, const char* trace, 1087 void WebRtcVoiceEngine::Print(webrtc::TraceLevel level, const char* trace,
1089 int length) { 1088 int length) {
1090 // Note: This callback can happen on any thread! 1089 // Note: This callback can happen on any thread!
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 } 2637 }
2639 } else { 2638 } else {
2640 LOG(LS_INFO) << "Stopping playout for channel #" << channel; 2639 LOG(LS_INFO) << "Stopping playout for channel #" << channel;
2641 engine()->voe()->base()->StopPlayout(channel); 2640 engine()->voe()->base()->StopPlayout(channel);
2642 } 2641 }
2643 return true; 2642 return true;
2644 } 2643 }
2645 } // namespace cricket 2644 } // namespace cricket
2646 2645
2647 #endif // HAVE_WEBRTC_VOICE 2646 #endif // HAVE_WEBRTC_VOICE
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698