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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 2307533004: Moving/renaming webrtc/common.h. (Closed)
Patch Set: rebase Created 4 years, 3 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/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_manager.h » ('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 (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
11 #include "webrtc/voice_engine/channel.h" 11 #include "webrtc/voice_engine/channel.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <utility> 14 #include <utility>
15 15
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/format_macros.h" 18 #include "webrtc/base/format_macros.h"
19 #include "webrtc/base/logging.h" 19 #include "webrtc/base/logging.h"
20 #include "webrtc/base/rate_limiter.h" 20 #include "webrtc/base/rate_limiter.h"
21 #include "webrtc/base/thread_checker.h" 21 #include "webrtc/base/thread_checker.h"
22 #include "webrtc/base/timeutils.h" 22 #include "webrtc/base/timeutils.h"
23 #include "webrtc/call/rtc_event_log.h" 23 #include "webrtc/call/rtc_event_log.h"
24 #include "webrtc/common.h"
25 #include "webrtc/config.h" 24 #include "webrtc/config.h"
26 #include "webrtc/modules/audio_device/include/audio_device.h" 25 #include "webrtc/modules/audio_device/include/audio_device.h"
27 #include "webrtc/modules/audio_processing/include/audio_processing.h" 26 #include "webrtc/modules/audio_processing/include/audio_processing.h"
28 #include "webrtc/modules/include/module_common_types.h" 27 #include "webrtc/modules/include/module_common_types.h"
29 #include "webrtc/modules/pacing/packet_router.h" 28 #include "webrtc/modules/pacing/packet_router.h"
30 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" 29 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
31 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" 30 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
32 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 31 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
33 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" 32 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
34 #include "webrtc/modules/utility/include/audio_frame_operations.h" 33 #include "webrtc/modules/utility/include/audio_frame_operations.h"
35 #include "webrtc/modules/utility/include/process_thread.h" 34 #include "webrtc/modules/utility/include/process_thread.h"
36 #include "webrtc/system_wrappers/include/trace.h" 35 #include "webrtc/system_wrappers/include/trace.h"
37 #include "webrtc/voice_engine/include/voe_base.h"
38 #include "webrtc/voice_engine/include/voe_external_media.h" 36 #include "webrtc/voice_engine/include/voe_external_media.h"
39 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 37 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
40 #include "webrtc/voice_engine/output_mixer.h" 38 #include "webrtc/voice_engine/output_mixer.h"
41 #include "webrtc/voice_engine/statistics.h" 39 #include "webrtc/voice_engine/statistics.h"
42 #include "webrtc/voice_engine/transmit_mixer.h" 40 #include "webrtc/voice_engine/transmit_mixer.h"
43 #include "webrtc/voice_engine/utility.h" 41 #include "webrtc/voice_engine/utility.h"
44 42
45 namespace webrtc { 43 namespace webrtc {
46 namespace voe { 44 namespace voe {
47 45
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 742 }
745 } 743 }
746 744
747 return (highestNeeded); 745 return (highestNeeded);
748 } 746 }
749 747
750 int32_t Channel::CreateChannel( 748 int32_t Channel::CreateChannel(
751 Channel*& channel, 749 Channel*& channel,
752 int32_t channelId, 750 int32_t channelId,
753 uint32_t instanceId, 751 uint32_t instanceId,
754 const Config& config, 752 const VoEBase::ChannelConfig& config) {
755 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
756 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId), 753 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
757 "Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId, 754 "Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId,
758 instanceId); 755 instanceId);
759 756
760 channel = new Channel(channelId, instanceId, config, decoder_factory); 757 channel = new Channel(channelId, instanceId, config);
761 if (channel == NULL) { 758 if (channel == NULL) {
762 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId), 759 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
763 "Channel::CreateChannel() unable to allocate memory for" 760 "Channel::CreateChannel() unable to allocate memory for"
764 " channel"); 761 " channel");
765 return -1; 762 return -1;
766 } 763 }
767 return 0; 764 return 0;
768 } 765 }
769 766
770 void Channel::PlayNotification(int32_t id, uint32_t durationMs) { 767 void Channel::PlayNotification(int32_t id, uint32_t durationMs) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 rtc::CritScope cs(&_fileCritSect); 806 rtc::CritScope cs(&_fileCritSect);
810 807
811 _outputFileRecording = false; 808 _outputFileRecording = false;
812 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, _channelId), 809 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, _channelId),
813 "Channel::RecordFileEnded() => output file recorder module is" 810 "Channel::RecordFileEnded() => output file recorder module is"
814 " shutdown"); 811 " shutdown");
815 } 812 }
816 813
817 Channel::Channel(int32_t channelId, 814 Channel::Channel(int32_t channelId,
818 uint32_t instanceId, 815 uint32_t instanceId,
819 const Config& config, 816 const VoEBase::ChannelConfig& config)
820 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)
821 : _instanceId(instanceId), 817 : _instanceId(instanceId),
822 _channelId(channelId), 818 _channelId(channelId),
823 event_log_proxy_(new RtcEventLogProxy()), 819 event_log_proxy_(new RtcEventLogProxy()),
824 rtp_header_parser_(RtpHeaderParser::Create()), 820 rtp_header_parser_(RtpHeaderParser::Create()),
825 rtp_payload_registry_( 821 rtp_payload_registry_(
826 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), 822 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))),
827 rtp_receive_statistics_( 823 rtp_receive_statistics_(
828 ReceiveStatistics::Create(Clock::GetRealTimeClock())), 824 ReceiveStatistics::Create(Clock::GetRealTimeClock())),
829 rtp_receiver_( 825 rtp_receiver_(
830 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), 826 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 _lastPayloadType(0), 872 _lastPayloadType(0),
877 _includeAudioLevelIndication(false), 873 _includeAudioLevelIndication(false),
878 _outputSpeechType(AudioFrame::kNormalSpeech), 874 _outputSpeechType(AudioFrame::kNormalSpeech),
879 _RxVadDetection(false), 875 _RxVadDetection(false),
880 _rxAgcIsEnabled(false), 876 _rxAgcIsEnabled(false),
881 _rxNsIsEnabled(false), 877 _rxNsIsEnabled(false),
882 restored_packet_in_use_(false), 878 restored_packet_in_use_(false),
883 rtcp_observer_(new VoERtcpObserver(this)), 879 rtcp_observer_(new VoERtcpObserver(this)),
884 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), 880 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())),
885 associate_send_channel_(ChannelOwner(nullptr)), 881 associate_send_channel_(ChannelOwner(nullptr)),
886 pacing_enabled_(config.Get<VoicePacing>().enabled), 882 pacing_enabled_(config.enable_voice_pacing),
887 feedback_observer_proxy_(new TransportFeedbackProxy()), 883 feedback_observer_proxy_(new TransportFeedbackProxy()),
888 seq_num_allocator_proxy_(new TransportSequenceNumberProxy()), 884 seq_num_allocator_proxy_(new TransportSequenceNumberProxy()),
889 rtp_packet_sender_proxy_(new RtpPacketSenderProxy()), 885 rtp_packet_sender_proxy_(new RtpPacketSenderProxy()),
890 retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(), 886 retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(),
891 kMaxRetransmissionWindowMs)), 887 kMaxRetransmissionWindowMs)),
892 decoder_factory_(decoder_factory) { 888 decoder_factory_(config.acm_config.decoder_factory) {
893 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId), 889 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId),
894 "Channel::Channel() - ctor"); 890 "Channel::Channel() - ctor");
895 AudioCodingModule::Config acm_config; 891 AudioCodingModule::Config acm_config(config.acm_config);
896 acm_config.id = VoEModuleId(instanceId, channelId); 892 acm_config.id = VoEModuleId(instanceId, channelId);
897 if (config.Get<NetEqCapacityConfig>().enabled) {
898 // Clamping the buffer capacity at 20 packets. While going lower will
899 // probably work, it makes little sense.
900 acm_config.neteq_config.max_packets_in_buffer =
901 std::max(20, config.Get<NetEqCapacityConfig>().capacity);
902 }
903 acm_config.neteq_config.enable_fast_accelerate =
904 config.Get<NetEqFastAccelerate>().enabled;
905 acm_config.neteq_config.enable_muted_state = true; 893 acm_config.neteq_config.enable_muted_state = true;
906 acm_config.decoder_factory = decoder_factory;
907 audio_coding_.reset(AudioCodingModule::Create(acm_config)); 894 audio_coding_.reset(AudioCodingModule::Create(acm_config));
908 895
909 _outputAudioLevel.Clear(); 896 _outputAudioLevel.Clear();
910 897
911 RtpRtcp::Configuration configuration; 898 RtpRtcp::Configuration configuration;
912 configuration.audio = true; 899 configuration.audio = true;
913 configuration.outgoing_transport = this; 900 configuration.outgoing_transport = this;
914 configuration.receive_statistics = rtp_receive_statistics_.get(); 901 configuration.receive_statistics = rtp_receive_statistics_.get();
915 configuration.bandwidth_callback = rtcp_observer_.get(); 902 configuration.bandwidth_callback = rtcp_observer_.get();
916 if (pacing_enabled_) { 903 if (pacing_enabled_) {
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
3486 int64_t min_rtt = 0; 3473 int64_t min_rtt = 0;
3487 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3474 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3488 0) { 3475 0) {
3489 return 0; 3476 return 0;
3490 } 3477 }
3491 return rtt; 3478 return rtt;
3492 } 3479 }
3493 3480
3494 } // namespace voe 3481 } // namespace voe
3495 } // namespace webrtc 3482 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698