| 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) | 
|   718     _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), |   717     : _fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()), | 
|   719     volume_settings_critsect_(*CriticalSectionWrapper::CreateCriticalSection()), |   718       _callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()), | 
|   720     _instanceId(instanceId), |   719       volume_settings_critsect_( | 
|   721     _channelId(channelId), |   720           *CriticalSectionWrapper::CreateCriticalSection()), | 
|   722     rtp_header_parser_(RtpHeaderParser::Create()), |   721       _instanceId(instanceId), | 
|   723     rtp_payload_registry_( |   722       _channelId(channelId), | 
|   724         new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), |   723       rtp_header_parser_(RtpHeaderParser::Create()), | 
|   725     rtp_receive_statistics_(ReceiveStatistics::Create( |   724       rtp_payload_registry_( | 
|   726         Clock::GetRealTimeClock())), |   725           new RTPPayloadRegistry(RTPPayloadStrategy::CreateStrategy(true))), | 
|   727     rtp_receiver_(RtpReceiver::CreateAudioReceiver( |   726       rtp_receive_statistics_( | 
|   728         VoEModuleId(instanceId, channelId), Clock::GetRealTimeClock(), this, |   727           ReceiveStatistics::Create(Clock::GetRealTimeClock())), | 
|   729         this, this, rtp_payload_registry_.get())), |   728       rtp_receiver_( | 
|   730     telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), |   729           RtpReceiver::CreateAudioReceiver(VoEModuleId(instanceId, channelId), | 
|   731     _outputAudioLevel(), |   730                                            Clock::GetRealTimeClock(), | 
|   732     _externalTransport(false), |   731                                            this, | 
|   733     _inputFilePlayerPtr(NULL), |   732                                            this, | 
|   734     _outputFilePlayerPtr(NULL), |   733                                            this, | 
|   735     _outputFileRecorderPtr(NULL), |   734                                            rtp_payload_registry_.get())), | 
|   736     // Avoid conflict with other channels by adding 1024 - 1026, |   735       telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()), | 
|   737     // won't use as much as 1024 channels. |   736       _outputAudioLevel(), | 
|   738     _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), |   737       _externalTransport(false), | 
|   739     _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), |   738       _inputFilePlayerPtr(NULL), | 
|   740     _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), |   739       _outputFilePlayerPtr(NULL), | 
|   741     _outputFileRecording(false), |   740       _outputFileRecorderPtr(NULL), | 
|   742     _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), |   741       // Avoid conflict with other channels by adding 1024 - 1026, | 
|   743     _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), |   742       // won't use as much as 1024 channels. | 
|   744     _outputExternalMedia(false), |   743       _inputFilePlayerId(VoEModuleId(instanceId, channelId) + 1024), | 
|   745     _inputExternalMediaCallbackPtr(NULL), |   744       _outputFilePlayerId(VoEModuleId(instanceId, channelId) + 1025), | 
|   746     _outputExternalMediaCallbackPtr(NULL), |   745       _outputFileRecorderId(VoEModuleId(instanceId, channelId) + 1026), | 
|   747     _timeStamp(0), // This is just an offset, RTP module will add it's own rando
      m offset |   746       _outputFileRecording(false), | 
|   748     _sendTelephoneEventPayloadType(106), |   747       _inbandDtmfQueue(VoEModuleId(instanceId, channelId)), | 
|   749     ntp_estimator_(Clock::GetRealTimeClock()), |   748       _inbandDtmfGenerator(VoEModuleId(instanceId, channelId)), | 
|   750     jitter_buffer_playout_timestamp_(0), |   749       _outputExternalMedia(false), | 
|   751     playout_timestamp_rtp_(0), |   750       _inputExternalMediaCallbackPtr(NULL), | 
|   752     playout_timestamp_rtcp_(0), |   751       _outputExternalMediaCallbackPtr(NULL), | 
|   753     playout_delay_ms_(0), |   752       _timeStamp(0),  // This is just an offset, RTP module will add it's own | 
|   754     _numberOfDiscardedPackets(0), |   753                       // random offset | 
|   755     send_sequence_number_(0), |   754       _sendTelephoneEventPayloadType(106), | 
|   756     ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), |   755       ntp_estimator_(Clock::GetRealTimeClock()), | 
|   757     rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), |   756       jitter_buffer_playout_timestamp_(0), | 
|   758     capture_start_rtp_time_stamp_(-1), |   757       playout_timestamp_rtp_(0), | 
|   759     capture_start_ntp_time_ms_(-1), |   758       playout_timestamp_rtcp_(0), | 
|   760     _engineStatisticsPtr(NULL), |   759       playout_delay_ms_(0), | 
|   761     _outputMixerPtr(NULL), |   760       _numberOfDiscardedPackets(0), | 
|   762     _transmitMixerPtr(NULL), |   761       send_sequence_number_(0), | 
|   763     _moduleProcessThreadPtr(NULL), |   762       ts_stats_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 
|   764     _audioDeviceModulePtr(NULL), |   763       rtp_ts_wraparound_handler_(new rtc::TimestampWrapAroundHandler()), | 
|   765     _voiceEngineObserverPtr(NULL), |   764       capture_start_rtp_time_stamp_(-1), | 
|   766     _callbackCritSectPtr(NULL), |   765       capture_start_ntp_time_ms_(-1), | 
|   767     _transportPtr(NULL), |   766       _engineStatisticsPtr(NULL), | 
|   768     _rxVadObserverPtr(NULL), |   767       _outputMixerPtr(NULL), | 
|   769     _oldVadDecision(-1), |   768       _transmitMixerPtr(NULL), | 
|   770     _sendFrameType(0), |   769       _moduleProcessThreadPtr(NULL), | 
|   771     _externalMixing(false), |   770       _audioDeviceModulePtr(NULL), | 
|   772     _mixFileWithMicrophone(false), |   771       _voiceEngineObserverPtr(NULL), | 
|   773     _mute(false), |   772       _callbackCritSectPtr(NULL), | 
|   774     _panLeft(1.0f), |   773       _transportPtr(NULL), | 
|   775     _panRight(1.0f), |   774       _rxVadObserverPtr(NULL), | 
|   776     _outputGain(1.0f), |   775       _oldVadDecision(-1), | 
|   777     _playOutbandDtmfEvent(false), |   776       _sendFrameType(0), | 
|   778     _playInbandDtmfEvent(false), |   777       _externalMixing(false), | 
|   779     _lastLocalTimeStamp(0), |   778       _mixFileWithMicrophone(false), | 
|   780     _lastPayloadType(0), |   779       _mute(false), | 
|   781     _includeAudioLevelIndication(false), |   780       _panLeft(1.0f), | 
|   782     _outputSpeechType(AudioFrame::kNormalSpeech), |   781       _panRight(1.0f), | 
|   783     _average_jitter_buffer_delay_us(0), |   782       _outputGain(1.0f), | 
|   784     least_required_delay_ms_(0), |   783       _playOutbandDtmfEvent(false), | 
|   785     _previousTimestamp(0), |   784       _playInbandDtmfEvent(false), | 
|   786     _recPacketDelayMs(20), |   785       _lastLocalTimeStamp(0), | 
|   787     _RxVadDetection(false), |   786       _lastPayloadType(0), | 
|   788     _rxAgcIsEnabled(false), |   787       _includeAudioLevelIndication(false), | 
|   789     _rxNsIsEnabled(false), |   788       _outputSpeechType(AudioFrame::kNormalSpeech), | 
|   790     restored_packet_in_use_(false), |   789       _average_jitter_buffer_delay_us(0), | 
|   791     rtcp_observer_(new VoERtcpObserver(this)), |   790       least_required_delay_ms_(0), | 
|   792     network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), |   791       _previousTimestamp(0), | 
|   793     assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), |   792       _recPacketDelayMs(20), | 
|   794     associate_send_channel_(ChannelOwner(nullptr)) |   793       _RxVadDetection(false), | 
|   795 { |   794       _rxAgcIsEnabled(false), | 
 |   795       _rxNsIsEnabled(false), | 
 |   796       restored_packet_in_use_(false), | 
 |   797       rtcp_observer_(new VoERtcpObserver(this)), | 
 |   798       network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())), | 
 |   799       assoc_send_channel_lock_(CriticalSectionWrapper::CreateCriticalSection()), | 
 |   800       associate_send_channel_(ChannelOwner(nullptr)) { | 
|   796     WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), |   801     WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId,_channelId), | 
|   797                  "Channel::Channel() - ctor"); |   802                  "Channel::Channel() - ctor"); | 
|   798     AudioCodingModule::Config acm_config; |   803     AudioCodingModule::Config acm_config; | 
|   799     acm_config.id = VoEModuleId(instanceId, channelId); |   804     acm_config.id = VoEModuleId(instanceId, channelId); | 
|   800     if (config.Get<NetEqCapacityConfig>().enabled) { |   805     if (config.Get<NetEqCapacityConfig>().enabled) { | 
|   801       // Clamping the buffer capacity at 20 packets. While going lower will |   806       // Clamping the buffer capacity at 20 packets. While going lower will | 
|   802       // probably work, it makes little sense. |   807       // probably work, it makes little sense. | 
|   803       acm_config.neteq_config.max_packets_in_buffer = |   808       acm_config.neteq_config.max_packets_in_buffer = | 
|   804           std::max(20, config.Get<NetEqCapacityConfig>().capacity); |   809           std::max(20, config.Get<NetEqCapacityConfig>().capacity); | 
|   805     } |   810     } | 
|   806     acm_config.neteq_config.enable_fast_accelerate = |   811     acm_config.neteq_config.enable_fast_accelerate = | 
|   807         config.Get<NetEqFastAccelerate>().enabled; |   812         config.Get<NetEqFastAccelerate>().enabled; | 
 |   813     acm_config.event_log = event_log; | 
|   808     audio_coding_.reset(AudioCodingModule::Create(acm_config)); |   814     audio_coding_.reset(AudioCodingModule::Create(acm_config)); | 
|   809  |   815  | 
|   810     _inbandDtmfQueue.ResetDtmf(); |   816     _inbandDtmfQueue.ResetDtmf(); | 
|   811     _inbandDtmfGenerator.Init(); |   817     _inbandDtmfGenerator.Init(); | 
|   812     _outputAudioLevel.Clear(); |   818     _outputAudioLevel.Clear(); | 
|   813  |   819  | 
|   814     RtpRtcp::Configuration configuration; |   820     RtpRtcp::Configuration configuration; | 
|   815     configuration.id = VoEModuleId(instanceId, channelId); |   821     configuration.id = VoEModuleId(instanceId, channelId); | 
|   816     configuration.audio = true; |   822     configuration.audio = true; | 
|   817     configuration.outgoing_transport = this; |   823     configuration.outgoing_transport = this; | 
| (...skipping 3313 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4131   int64_t min_rtt = 0; |  4137   int64_t min_rtt = 0; | 
|  4132   if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) |  4138   if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) | 
|  4133       != 0) { |  4139       != 0) { | 
|  4134     return 0; |  4140     return 0; | 
|  4135   } |  4141   } | 
|  4136   return rtt; |  4142   return rtt; | 
|  4137 } |  4143 } | 
|  4138  |  4144  | 
|  4139 }  // namespace voe |  4145 }  // namespace voe | 
|  4140 }  // namespace webrtc |  4146 }  // namespace webrtc | 
| OLD | NEW |