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

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

Issue 2307533004: Moving/renaming webrtc/common.h. (Closed)
Patch Set: Comments+small fixes 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
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"
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 743 }
745 } 744 }
746 745
747 return (highestNeeded); 746 return (highestNeeded);
748 } 747 }
749 748
750 int32_t Channel::CreateChannel( 749 int32_t Channel::CreateChannel(
751 Channel*& channel, 750 Channel*& channel,
752 int32_t channelId, 751 int32_t channelId,
753 uint32_t instanceId, 752 uint32_t instanceId,
754 const Config& config, 753 const AudioCodingModule::Config& acm_config) {
755 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
756 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId), 754 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
757 "Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId, 755 "Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId,
758 instanceId); 756 instanceId);
759 757
760 channel = new Channel(channelId, instanceId, config, decoder_factory); 758 channel = new Channel(channelId, instanceId, acm_config);
761 if (channel == NULL) { 759 if (channel == NULL) {
762 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId), 760 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
763 "Channel::CreateChannel() unable to allocate memory for" 761 "Channel::CreateChannel() unable to allocate memory for"
764 " channel"); 762 " channel");
765 return -1; 763 return -1;
766 } 764 }
767 return 0; 765 return 0;
768 } 766 }
769 767
770 void Channel::PlayNotification(int32_t id, uint32_t durationMs) { 768 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); 807 rtc::CritScope cs(&_fileCritSect);
810 808
811 _outputFileRecording = false; 809 _outputFileRecording = false;
812 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, _channelId), 810 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, _channelId),
813 "Channel::RecordFileEnded() => output file recorder module is" 811 "Channel::RecordFileEnded() => output file recorder module is"
814 " shutdown"); 812 " shutdown");
815 } 813 }
816 814
817 Channel::Channel(int32_t channelId, 815 Channel::Channel(int32_t channelId,
818 uint32_t instanceId, 816 uint32_t instanceId,
819 const Config& config, 817 const AudioCodingModule::Config& acm_config)
820 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)
821 : _instanceId(instanceId), 818 : _instanceId(instanceId),
822 _channelId(channelId), 819 _channelId(channelId),
823 event_log_proxy_(new RtcEventLogProxy()), 820 event_log_proxy_(new RtcEventLogProxy()),
824 rtp_header_parser_(RtpHeaderParser::Create()), 821 rtp_header_parser_(RtpHeaderParser::Create()),
825 rtp_payload_registry_( 822 rtp_payload_registry_(
826 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), 823 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))),
827 rtp_receive_statistics_( 824 rtp_receive_statistics_(
828 ReceiveStatistics::Create(Clock::GetRealTimeClock())), 825 ReceiveStatistics::Create(Clock::GetRealTimeClock())),
829 rtp_receiver_( 826 rtp_receiver_(
830 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(), 827 RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 _lastPayloadType(0), 873 _lastPayloadType(0),
877 _includeAudioLevelIndication(false), 874 _includeAudioLevelIndication(false),
878 _outputSpeechType(AudioFrame::kNormalSpeech), 875 _outputSpeechType(AudioFrame::kNormalSpeech),
879 _RxVadDetection(false), 876 _RxVadDetection(false),
880 _rxAgcIsEnabled(false), 877 _rxAgcIsEnabled(false),
881 _rxNsIsEnabled(false), 878 _rxNsIsEnabled(false),
882 restored_packet_in_use_(false), 879 restored_packet_in_use_(false),
883 rtcp_observer_(new VoERtcpObserver(this)), 880 rtcp_observer_(new VoERtcpObserver(this)),
884 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), 881 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())),
885 associate_send_channel_(ChannelOwner(nullptr)), 882 associate_send_channel_(ChannelOwner(nullptr)),
886 pacing_enabled_(config.Get<VoicePacing>().enabled), 883 pacing_enabled_(true), // TODO(solenberg): Remove flag.
stefan-webrtc 2016/09/02 08:23:17 Doesn't look too complicated to actually remove th
the sun 2016/09/02 08:54:40 Yes, I realized, and that's why, unfortunately, we
887 feedback_observer_proxy_(new TransportFeedbackProxy()), 884 feedback_observer_proxy_(new TransportFeedbackProxy()),
888 seq_num_allocator_proxy_(new TransportSequenceNumberProxy()), 885 seq_num_allocator_proxy_(new TransportSequenceNumberProxy()),
889 rtp_packet_sender_proxy_(new RtpPacketSenderProxy()), 886 rtp_packet_sender_proxy_(new RtpPacketSenderProxy()),
890 retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(), 887 retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(),
891 kMaxRetransmissionWindowMs)), 888 kMaxRetransmissionWindowMs)),
892 decoder_factory_(decoder_factory) { 889 decoder_factory_(acm_config.decoder_factory) {
893 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId), 890 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId),
894 "Channel::Channel() - ctor"); 891 "Channel::Channel() - ctor");
895 AudioCodingModule::Config acm_config; 892 AudioCodingModule::Config acm_config_copy(acm_config);
896 acm_config.id = VoEModuleId(instanceId, channelId); 893 acm_config_copy.id = VoEModuleId(instanceId, channelId);
897 if (config.Get<NetEqCapacityConfig>().enabled) { 894 acm_config_copy.neteq_config.enable_muted_state = true;
898 // Clamping the buffer capacity at 20 packets. While going lower will 895 audio_coding_.reset(AudioCodingModule::Create(acm_config_copy));
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;
906 acm_config.decoder_factory = decoder_factory;
907 audio_coding_.reset(AudioCodingModule::Create(acm_config));
908 896
909 _outputAudioLevel.Clear(); 897 _outputAudioLevel.Clear();
910 898
911 RtpRtcp::Configuration configuration; 899 RtpRtcp::Configuration configuration;
912 configuration.audio = true; 900 configuration.audio = true;
913 configuration.outgoing_transport = this; 901 configuration.outgoing_transport = this;
914 configuration.receive_statistics = rtp_receive_statistics_.get(); 902 configuration.receive_statistics = rtp_receive_statistics_.get();
915 configuration.bandwidth_callback = rtcp_observer_.get(); 903 configuration.bandwidth_callback = rtcp_observer_.get();
916 if (pacing_enabled_) { 904 if (pacing_enabled_) {
917 configuration.paced_sender = rtp_packet_sender_proxy_.get(); 905 configuration.paced_sender = rtp_packet_sender_proxy_.get();
(...skipping 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after
3486 int64_t min_rtt = 0; 3474 int64_t min_rtt = 0;
3487 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3475 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3488 0) { 3476 0) {
3489 return 0; 3477 return 0;
3490 } 3478 }
3491 return rtt; 3479 return rtt;
3492 } 3480 }
3493 3481
3494 } // namespace voe 3482 } // namespace voe
3495 } // namespace webrtc 3483 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698