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

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: Merge 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
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.h ('k') | talk/media/webrtc/webrtcvoiceengine_unittest.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 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 510
511 signal_thread_checker_.DetachFromThread(); 511 signal_thread_checker_.DetachFromThread();
512 std::memset(&default_agc_config_, 0, sizeof(default_agc_config_)); 512 std::memset(&default_agc_config_, 0, sizeof(default_agc_config_));
513 513
514 webrtc::Trace::set_level_filter(kDefaultTraceFilter); 514 webrtc::Trace::set_level_filter(kDefaultTraceFilter);
515 webrtc::Trace::SetTraceCallback(this); 515 webrtc::Trace::SetTraceCallback(this);
516 516
517 // Load our audio codec list. 517 // Load our audio codec list.
518 codecs_ = WebRtcVoiceCodecs::SupportedCodecs(); 518 codecs_ = WebRtcVoiceCodecs::SupportedCodecs();
519 519
520 // Load our RTP Header extensions.
521 rtp_header_extensions_.push_back(
522 RtpHeaderExtension(kRtpAudioLevelHeaderExtension,
523 kRtpAudioLevelHeaderExtensionDefaultId));
524 rtp_header_extensions_.push_back(
525 RtpHeaderExtension(kRtpAbsoluteSenderTimeHeaderExtension,
526 kRtpAbsoluteSenderTimeHeaderExtensionDefaultId));
527 if (webrtc::field_trial::FindFullName("WebRTC-SendSideBwe") == "Enabled") {
528 rtp_header_extensions_.push_back(RtpHeaderExtension(
529 kRtpTransportSequenceNumberHeaderExtension,
530 kRtpTransportSequenceNumberHeaderExtensionDefaultId));
531 }
532 options_ = GetDefaultEngineOptions(); 520 options_ = GetDefaultEngineOptions();
533 voe_config_.Set<webrtc::VoicePacing>(new webrtc::VoicePacing(true)); 521 voe_config_.Set<webrtc::VoicePacing>(new webrtc::VoicePacing(true));
534 } 522 }
535 523
536 WebRtcVoiceEngine::~WebRtcVoiceEngine() { 524 WebRtcVoiceEngine::~WebRtcVoiceEngine() {
537 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 525 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
538 LOG(LS_VERBOSE) << "WebRtcVoiceEngine::~WebRtcVoiceEngine"; 526 LOG(LS_VERBOSE) << "WebRtcVoiceEngine::~WebRtcVoiceEngine";
539 if (adm_) { 527 if (adm_) {
540 voe_wrapper_.reset(); 528 voe_wrapper_.reset();
541 adm_->Release(); 529 adm_->Release();
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 unsigned int ulevel; 1056 unsigned int ulevel;
1069 return (voe_wrapper_->volume()->GetSpeechInputLevel(ulevel) != -1) ? 1057 return (voe_wrapper_->volume()->GetSpeechInputLevel(ulevel) != -1) ?
1070 static_cast<int>(ulevel) : -1; 1058 static_cast<int>(ulevel) : -1;
1071 } 1059 }
1072 1060
1073 const std::vector<AudioCodec>& WebRtcVoiceEngine::codecs() { 1061 const std::vector<AudioCodec>& WebRtcVoiceEngine::codecs() {
1074 RTC_DCHECK(signal_thread_checker_.CalledOnValidThread()); 1062 RTC_DCHECK(signal_thread_checker_.CalledOnValidThread());
1075 return codecs_; 1063 return codecs_;
1076 } 1064 }
1077 1065
1078 const std::vector<RtpHeaderExtension>& 1066 RtpCapabilities WebRtcVoiceEngine::GetCapabilities() const {
1079 WebRtcVoiceEngine::rtp_header_extensions() const {
1080 RTC_DCHECK(signal_thread_checker_.CalledOnValidThread()); 1067 RTC_DCHECK(signal_thread_checker_.CalledOnValidThread());
1081 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;
1082 } 1080 }
1083 1081
1084 int WebRtcVoiceEngine::GetLastEngineError() { 1082 int WebRtcVoiceEngine::GetLastEngineError() {
1085 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1083 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1086 return voe_wrapper_->error(); 1084 return voe_wrapper_->error();
1087 } 1085 }
1088 1086
1089 void WebRtcVoiceEngine::Print(webrtc::TraceLevel level, const char* trace, 1087 void WebRtcVoiceEngine::Print(webrtc::TraceLevel level, const char* trace,
1090 int length) { 1088 int length) {
1091 // Note: This callback can happen on any thread! 1089 // Note: This callback can happen on any thread!
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 } 2636 }
2639 } else { 2637 } else {
2640 LOG(LS_INFO) << "Stopping playout for channel #" << channel; 2638 LOG(LS_INFO) << "Stopping playout for channel #" << channel;
2641 engine()->voe()->base()->StopPlayout(channel); 2639 engine()->voe()->base()->StopPlayout(channel);
2642 } 2640 }
2643 return true; 2641 return true;
2644 } 2642 }
2645 } // namespace cricket 2643 } // namespace cricket
2646 2644
2647 #endif // HAVE_WEBRTC_VOICE 2645 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.h ('k') | talk/media/webrtc/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698