OLD | NEW |
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 |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 if(_outputFilePlayerPtr->Frequency()>highestNeeded) | 621 if(_outputFilePlayerPtr->Frequency()>highestNeeded) |
622 { | 622 { |
623 highestNeeded=_outputFilePlayerPtr->Frequency(); | 623 highestNeeded=_outputFilePlayerPtr->Frequency(); |
624 } | 624 } |
625 } | 625 } |
626 } | 626 } |
627 | 627 |
628 return(highestNeeded); | 628 return(highestNeeded); |
629 } | 629 } |
630 | 630 |
631 int32_t | 631 int32_t Channel::CreateChannel(Channel*& channel, |
632 Channel::CreateChannel(Channel*& channel, | 632 int32_t channelId, |
633 int32_t channelId, | 633 uint32_t instanceId, |
634 uint32_t instanceId, | 634 RtcEventLog* const event_log, |
635 const Config& config) | 635 const Config& config) { |
636 { | |
637 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId,channelId), | 636 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId,channelId), |
638 "Channel::CreateChannel(channelId=%d, instanceId=%d)", | 637 "Channel::CreateChannel(channelId=%d, instanceId=%d)", |
639 channelId, instanceId); | 638 channelId, instanceId); |
640 | 639 |
641 channel = new Channel(channelId, instanceId, config); | 640 channel = new Channel(channelId, instanceId, event_log, config); |
642 if (channel == NULL) | 641 if (channel == NULL) |
643 { | 642 { |
644 WEBRTC_TRACE(kTraceMemory, kTraceVoice, | 643 WEBRTC_TRACE(kTraceMemory, kTraceVoice, |
645 VoEId(instanceId,channelId), | 644 VoEId(instanceId,channelId), |
646 "Channel::CreateChannel() unable to allocate memory for" | 645 "Channel::CreateChannel() unable to allocate memory for" |
647 " channel"); | 646 " channel"); |
648 return -1; | 647 return -1; |
649 } | 648 } |
650 return 0; | 649 return 0; |
651 } | 650 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 705 |
707 _outputFileRecording = false; | 706 _outputFileRecording = false; |
708 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, | 707 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, |
709 VoEId(_instanceId,_channelId), | 708 VoEId(_instanceId,_channelId), |
710 "Channel::RecordFileEnded() => output file recorder module is" | 709 "Channel::RecordFileEnded() => output file recorder module is" |
711 " shutdown"); | 710 " shutdown"); |
712 } | 711 } |
713 | 712 |
714 Channel::Channel(int32_t channelId, | 713 Channel::Channel(int32_t channelId, |
715 uint32_t instanceId, | 714 uint32_t instanceId, |
716 const Config& config) : | 715 RtcEventLog* const event_log, |
717 _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), | 716 const Config& config) |
| 717 : _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), |
718 _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), | 718 _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), |
719 volume_settings_critsect_(*CriticalSectionWrapper::CreateCriticalSection()), | 719 volume_settings_critsect_(*CriticalSectionWrapper::CreateCriticalSection()), |
720 _instanceId(instanceId), | 720 _instanceId(instanceId), |
721 _channelId(channelId), | 721 _channelId(channelId), |
722 rtp_header_parser_(RtpHeaderParser::Create()), | 722 rtp_header_parser_(RtpHeaderParser::Create()), |
723 rtp_payload_registry_( | 723 rtp_payload_registry_( |
724 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), | 724 new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), |
725 rtp_receive_statistics_(ReceiveStatistics::Create( | 725 rtp_receive_statistics_( |
726 Clock::GetRealTimeClock())), | 726 ReceiveStatistics::Create(Clock::GetRealTimeClock())), |
727 rtp_receiver_(RtpReceiver::CreateAudioReceiver( | 727 rtp_receiver_( |
728 VoEModuleId(instanceId, channelId), Clock::GetRealTimeClock(), this, | 728 RtpReceiver::CreateAudioReceiver(VoEModuleId(instanceId, channelId), |
729 this, this, rtp_payload_registry_.get())), | 729 Clock::GetRealTimeClock(), |
| 730 this, |
| 731 this, |
| 732 this, |
| 733 rtp_payload_registry_.get())), |
730 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), | 734 telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), |
731 _outputAudioLevel(), | 735 _outputAudioLevel(), |
732 _externalTransport(false), | 736 _externalTransport(false), |
733 _inputFilePlayerPtr(NULL), | 737 _inputFilePlayerPtr(NULL), |
734 _outputFilePlayerPtr(NULL), | 738 _outputFilePlayerPtr(NULL), |
735 _outputFileRecorderPtr(NULL), | 739 _outputFileRecorderPtr(NULL), |
736 // Avoid conflict with other channels by adding 1024 - 1026, | 740 // Avoid conflict with other channels by adding 1024 - 1026, |
737 // won't use as much as 1024 channels. | 741 // won't use as much as 1024 channels. |
738 _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), | 742 _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), |
739 _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), | 743 _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), |
740 _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), | 744 _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), |
741 _outputFileRecording(false), | 745 _outputFileRecording(false), |
742 _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), | 746 _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), |
743 _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), | 747 _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), |
744 _outputExternalMedia(false), | 748 _outputExternalMedia(false), |
745 _inputExternalMediaCallbackPtr(NULL), | 749 _inputExternalMediaCallbackPtr(NULL), |
746 _outputExternalMediaCallbackPtr(NULL), | 750 _outputExternalMediaCallbackPtr(NULL), |
747 _timeStamp(0), // This is just an offset, RTP module will add it's own rando
m offset | 751 _timeStamp(0), // This is just an offset, RTP module will add it's own |
| 752 // random offset |
748 _sendTelephoneEventPayloadType(106), | 753 _sendTelephoneEventPayloadType(106), |
749 ntp_estimator_(Clock::GetRealTimeClock()), | 754 ntp_estimator_(Clock::GetRealTimeClock()), |
750 jitter_buffer_playout_timestamp_(0), | 755 jitter_buffer_playout_timestamp_(0), |
751 playout_timestamp_rtp_(0), | 756 playout_timestamp_rtp_(0), |
752 playout_timestamp_rtcp_(0), | 757 playout_timestamp_rtcp_(0), |
753 playout_delay_ms_(0), | 758 playout_delay_ms_(0), |
754 _numberOfDiscardedPackets(0), | 759 _numberOfDiscardedPackets(0), |
755 send_sequence_number_(0), | 760 send_sequence_number_(0), |
756 ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 761 ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), |
757 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), | 762 rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), |
(...skipping 26 matching lines...) Expand all Loading... |
784 _average_jitter_buffer_delay_us(0), | 789 _average_jitter_buffer_delay_us(0), |
785 _previousTimestamp(0), | 790 _previousTimestamp(0), |
786 _recPacketDelayMs(20), | 791 _recPacketDelayMs(20), |
787 _RxVadDetection(false), | 792 _RxVadDetection(false), |
788 _rxAgcIsEnabled(false), | 793 _rxAgcIsEnabled(false), |
789 _rxNsIsEnabled(false), | 794 _rxNsIsEnabled(false), |
790 restored_packet_in_use_(false), | 795 restored_packet_in_use_(false), |
791 rtcp_observer_(new VoERtcpObserver(this)), | 796 rtcp_observer_(new VoERtcpObserver(this)), |
792 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), | 797 network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), |
793 assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 798 assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), |
794 associate_send_channel_(ChannelOwner(nullptr)) | 799 associate_send_channel_(ChannelOwner(nullptr)) { |
795 { | |
796 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), | 800 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), |
797 "Channel::Channel() - ctor"); | 801 "Channel::Channel() - ctor"); |
798 AudioCodingModule::Config acm_config; | 802 AudioCodingModule::Config acm_config; |
799 acm_config.id = VoEModuleId(instanceId, channelId); | 803 acm_config.id = VoEModuleId(instanceId, channelId); |
800 if (config.Get<NetEqCapacityConfig>().enabled) { | 804 if (config.Get<NetEqCapacityConfig>().enabled) { |
801 // Clamping the buffer capacity at 20 packets. While going lower will | 805 // Clamping the buffer capacity at 20 packets. While going lower will |
802 // probably work, it makes little sense. | 806 // probably work, it makes little sense. |
803 acm_config.neteq_config.max_packets_in_buffer = | 807 acm_config.neteq_config.max_packets_in_buffer = |
804 std::max(20, config.Get<NetEqCapacityConfig>().capacity); | 808 std::max(20, config.Get<NetEqCapacityConfig>().capacity); |
805 } | 809 } |
806 acm_config.neteq_config.enable_fast_accelerate = | 810 acm_config.neteq_config.enable_fast_accelerate = |
807 config.Get<NetEqFastAccelerate>().enabled; | 811 config.Get<NetEqFastAccelerate>().enabled; |
| 812 acm_config.event_log = event_log; |
808 audio_coding_.reset(AudioCodingModule::Create(acm_config)); | 813 audio_coding_.reset(AudioCodingModule::Create(acm_config)); |
809 | 814 |
810 _inbandDtmfQueue.ResetDtmf(); | 815 _inbandDtmfQueue.ResetDtmf(); |
811 _inbandDtmfGenerator.Init(); | 816 _inbandDtmfGenerator.Init(); |
812 _outputAudioLevel.Clear(); | 817 _outputAudioLevel.Clear(); |
813 | 818 |
814 RtpRtcp::Configuration configuration; | 819 RtpRtcp::Configuration configuration; |
815 configuration.id = VoEModuleId(instanceId, channelId); | 820 configuration.id = VoEModuleId(instanceId, channelId); |
816 configuration.audio = true; | 821 configuration.audio = true; |
817 configuration.outgoing_transport = this; | 822 configuration.outgoing_transport = this; |
(...skipping 3329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4147 int64_t min_rtt = 0; | 4152 int64_t min_rtt = 0; |
4148 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) | 4153 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) |
4149 != 0) { | 4154 != 0) { |
4150 return 0; | 4155 return 0; |
4151 } | 4156 } |
4152 return rtt; | 4157 return rtt; |
4153 } | 4158 } |
4154 | 4159 |
4155 } // namespace voe | 4160 } // namespace voe |
4156 } // namespace webrtc | 4161 } // namespace webrtc |
OLD | NEW |