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

Side by Side Diff: voice_engine/channel.h

Issue 3020473002: Remove voe::Statistics. (Closed)
Patch Set: rebase Created 3 years, 2 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 | « voice_engine/BUILD.gn ('k') | voice_engine/channel.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 * 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 uint32_t interarrival_jitter; 83 uint32_t interarrival_jitter;
84 uint32_t last_SR_timestamp; 84 uint32_t last_SR_timestamp;
85 uint32_t delay_since_last_SR; 85 uint32_t delay_since_last_SR;
86 }; 86 };
87 87
88 namespace voe { 88 namespace voe {
89 89
90 class RtcEventLogProxy; 90 class RtcEventLogProxy;
91 class RtcpRttStatsProxy; 91 class RtcpRttStatsProxy;
92 class RtpPacketSenderProxy; 92 class RtpPacketSenderProxy;
93 class Statistics;
94 class TransportFeedbackProxy; 93 class TransportFeedbackProxy;
95 class TransportSequenceNumberProxy; 94 class TransportSequenceNumberProxy;
96 class VoERtcpObserver; 95 class VoERtcpObserver;
97 96
98 // Helper class to simplify locking scheme for members that are accessed from 97 // Helper class to simplify locking scheme for members that are accessed from
99 // multiple threads. 98 // multiple threads.
100 // Example: a member can be set on thread T1 and read by an internal audio 99 // Example: a member can be set on thread T1 and read by an internal audio
101 // thread T2. Accessing the member via this class ensures that we are 100 // thread T2. Accessing the member via this class ensures that we are
102 // safe and also avoid TSan v2 warnings. 101 // safe and also avoid TSan v2 warnings.
103 class ChannelState { 102 class ChannelState {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 virtual ~Channel(); 149 virtual ~Channel();
151 static int32_t CreateChannel(Channel*& channel, 150 static int32_t CreateChannel(Channel*& channel,
152 int32_t channelId, 151 int32_t channelId,
153 uint32_t instanceId, 152 uint32_t instanceId,
154 const VoEBase::ChannelConfig& config); 153 const VoEBase::ChannelConfig& config);
155 Channel(int32_t channelId, 154 Channel(int32_t channelId,
156 uint32_t instanceId, 155 uint32_t instanceId,
157 const VoEBase::ChannelConfig& config); 156 const VoEBase::ChannelConfig& config);
158 int32_t Init(); 157 int32_t Init();
159 void Terminate(); 158 void Terminate();
160 int32_t SetEngineInformation(Statistics& engineStatistics, 159 int32_t SetEngineInformation(ProcessThread& moduleProcessThread,
161 ProcessThread& moduleProcessThread,
162 AudioDeviceModule& audioDeviceModule, 160 AudioDeviceModule& audioDeviceModule,
163 rtc::CriticalSection* callbackCritSect,
164 rtc::TaskQueue* encoder_queue); 161 rtc::TaskQueue* encoder_queue);
165 162
166 void SetSink(std::unique_ptr<AudioSinkInterface> sink); 163 void SetSink(std::unique_ptr<AudioSinkInterface> sink);
167 164
168 // TODO(ossu): Don't use! It's only here to confirm that the decoder factory 165 // TODO(ossu): Don't use! It's only here to confirm that the decoder factory
169 // passed into AudioReceiveStream is the same as the one set when creating the 166 // passed into AudioReceiveStream is the same as the one set when creating the
170 // ADM. Once Channel creation is moved into Audio{Send,Receive}Stream this can 167 // ADM. Once Channel creation is moved into Audio{Send,Receive}Stream this can
171 // go. 168 // go.
172 const rtc::scoped_refptr<AudioDecoderFactory>& GetAudioDecoderFactory() const; 169 const rtc::scoped_refptr<AudioDecoderFactory>& GetAudioDecoderFactory() const;
173 170
(...skipping 16 matching lines...) Expand all
190 int32_t GetSendCodec(CodecInst& codec); 187 int32_t GetSendCodec(CodecInst& codec);
191 int32_t GetRecCodec(CodecInst& codec); 188 int32_t GetRecCodec(CodecInst& codec);
192 int32_t SetSendCodec(const CodecInst& codec); 189 int32_t SetSendCodec(const CodecInst& codec);
193 void SetBitRate(int bitrate_bps, int64_t probing_interval_ms); 190 void SetBitRate(int bitrate_bps, int64_t probing_interval_ms);
194 bool EnableAudioNetworkAdaptor(const std::string& config_string); 191 bool EnableAudioNetworkAdaptor(const std::string& config_string);
195 void DisableAudioNetworkAdaptor(); 192 void DisableAudioNetworkAdaptor();
196 void SetReceiverFrameLengthRange(int min_frame_length_ms, 193 void SetReceiverFrameLengthRange(int min_frame_length_ms,
197 int max_frame_length_ms); 194 int max_frame_length_ms);
198 195
199 // Network 196 // Network
200 int32_t RegisterExternalTransport(Transport* transport); 197 void RegisterTransport(Transport* transport);
201 int32_t DeRegisterExternalTransport();
202 // TODO(nisse, solenberg): Delete when VoENetwork is deleted. 198 // TODO(nisse, solenberg): Delete when VoENetwork is deleted.
203 int32_t ReceivedRTCPPacket(const uint8_t* data, size_t length); 199 int32_t ReceivedRTCPPacket(const uint8_t* data, size_t length);
204 void OnRtpPacket(const RtpPacketReceived& packet); 200 void OnRtpPacket(const RtpPacketReceived& packet);
205 201
206 // Muting, Volume and Level. 202 // Muting, Volume and Level.
207 void SetInputMute(bool enable); 203 void SetInputMute(bool enable);
208 void SetChannelOutputVolumeScaling(float scaling); 204 void SetChannelOutputVolumeScaling(float scaling);
209 int GetSpeechOutputLevel() const; 205 int GetSpeechOutputLevel() const;
210 int GetSpeechOutputLevelFullRange() const; 206 int GetSpeechOutputLevelFullRange() const;
211 // See description of "totalAudioEnergy" in the WebRTC stats spec: 207 // See description of "totalAudioEnergy" in the WebRTC stats spec:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 AudioMixer::Source::AudioFrameInfo GetAudioFrameWithInfo( 275 AudioMixer::Source::AudioFrameInfo GetAudioFrameWithInfo(
280 int sample_rate_hz, 276 int sample_rate_hz,
281 AudioFrame* audio_frame); 277 AudioFrame* audio_frame);
282 278
283 int PreferredSampleRate() const; 279 int PreferredSampleRate() const;
284 280
285 uint32_t InstanceId() const { return _instanceId; } 281 uint32_t InstanceId() const { return _instanceId; }
286 int32_t ChannelId() const { return _channelId; } 282 int32_t ChannelId() const { return _channelId; }
287 bool Playing() const { return channel_state_.Get().playing; } 283 bool Playing() const { return channel_state_.Get().playing; }
288 bool Sending() const { return channel_state_.Get().sending; } 284 bool Sending() const { return channel_state_.Get().sending; }
289 bool ExternalTransport() const {
290 rtc::CritScope cs(&_callbackCritSect);
291 return _externalTransport;
292 }
293 RtpRtcp* RtpRtcpModulePtr() const { return _rtpRtcpModule.get(); } 285 RtpRtcp* RtpRtcpModulePtr() const { return _rtpRtcpModule.get(); }
294 int8_t OutputEnergyLevel() const { return _outputAudioLevel.Level(); } 286 int8_t OutputEnergyLevel() const { return _outputAudioLevel.Level(); }
295 287
296 // ProcessAndEncodeAudio() creates an audio frame copy and posts a task 288 // ProcessAndEncodeAudio() creates an audio frame copy and posts a task
297 // on the shared encoder task queue, wich in turn calls (on the queue) 289 // on the shared encoder task queue, wich in turn calls (on the queue)
298 // ProcessAndEncodeAudioOnTaskQueue() where the actual processing of the 290 // ProcessAndEncodeAudioOnTaskQueue() where the actual processing of the
299 // audio takes place. The processing mainly consists of encoding and preparing 291 // audio takes place. The processing mainly consists of encoding and preparing
300 // the result for sending by adding it to a send queue. 292 // the result for sending by adding it to a send queue.
301 // The main reason for using a task queue here is to release the native, 293 // The main reason for using a task queue here is to release the native,
302 // OS-specific, audio capture thread as soon as possible to ensure that it 294 // OS-specific, audio capture thread as soon as possible to ensure that it
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_; 380 std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_;
389 std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_; 381 std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_;
390 std::unique_ptr<RtpReceiver> rtp_receiver_; 382 std::unique_ptr<RtpReceiver> rtp_receiver_;
391 TelephoneEventHandler* telephone_event_handler_; 383 TelephoneEventHandler* telephone_event_handler_;
392 std::unique_ptr<RtpRtcp> _rtpRtcpModule; 384 std::unique_ptr<RtpRtcp> _rtpRtcpModule;
393 std::unique_ptr<AudioCodingModule> audio_coding_; 385 std::unique_ptr<AudioCodingModule> audio_coding_;
394 acm2::CodecManager codec_manager_; 386 acm2::CodecManager codec_manager_;
395 acm2::RentACodec rent_a_codec_; 387 acm2::RentACodec rent_a_codec_;
396 std::unique_ptr<AudioSinkInterface> audio_sink_; 388 std::unique_ptr<AudioSinkInterface> audio_sink_;
397 AudioLevel _outputAudioLevel; 389 AudioLevel _outputAudioLevel;
398 bool _externalTransport;
399 // Downsamples to the codec rate if necessary. 390 // Downsamples to the codec rate if necessary.
400 PushResampler<int16_t> input_resampler_; 391 PushResampler<int16_t> input_resampler_;
401 uint32_t _timeStamp RTC_ACCESS_ON(encoder_queue_); 392 uint32_t _timeStamp RTC_ACCESS_ON(encoder_queue_);
402 393
403 RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(ts_stats_lock_); 394 RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(ts_stats_lock_);
404 395
405 // Timestamp of the audio pulled from NetEq. 396 // Timestamp of the audio pulled from NetEq.
406 rtc::Optional<uint32_t> jitter_buffer_playout_timestamp_; 397 rtc::Optional<uint32_t> jitter_buffer_playout_timestamp_;
407 398
408 rtc::CriticalSection video_sync_lock_; 399 rtc::CriticalSection video_sync_lock_;
409 uint32_t playout_timestamp_rtp_ RTC_GUARDED_BY(video_sync_lock_); 400 uint32_t playout_timestamp_rtp_ RTC_GUARDED_BY(video_sync_lock_);
410 uint32_t playout_delay_ms_ RTC_GUARDED_BY(video_sync_lock_); 401 uint32_t playout_delay_ms_ RTC_GUARDED_BY(video_sync_lock_);
411 uint16_t send_sequence_number_; 402 uint16_t send_sequence_number_;
412 403
413 rtc::CriticalSection ts_stats_lock_; 404 rtc::CriticalSection ts_stats_lock_;
414 405
415 std::unique_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_; 406 std::unique_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_;
416 // The rtp timestamp of the first played out audio frame. 407 // The rtp timestamp of the first played out audio frame.
417 int64_t capture_start_rtp_time_stamp_; 408 int64_t capture_start_rtp_time_stamp_;
418 // The capture ntp time (in local timebase) of the first played out audio 409 // The capture ntp time (in local timebase) of the first played out audio
419 // frame. 410 // frame.
420 int64_t capture_start_ntp_time_ms_ RTC_GUARDED_BY(ts_stats_lock_); 411 int64_t capture_start_ntp_time_ms_ RTC_GUARDED_BY(ts_stats_lock_);
421 412
422 // uses 413 // uses
423 Statistics* _engineStatisticsPtr;
424 ProcessThread* _moduleProcessThreadPtr; 414 ProcessThread* _moduleProcessThreadPtr;
425 AudioDeviceModule* _audioDeviceModulePtr; 415 AudioDeviceModule* _audioDeviceModulePtr;
426 rtc::CriticalSection* _callbackCritSectPtr; // owned by base
427 Transport* _transportPtr; // WebRtc socket or external transport 416 Transport* _transportPtr; // WebRtc socket or external transport
428 RmsLevel rms_level_ RTC_ACCESS_ON(encoder_queue_); 417 RmsLevel rms_level_ RTC_ACCESS_ON(encoder_queue_);
429 bool input_mute_ RTC_GUARDED_BY(volume_settings_critsect_); 418 bool input_mute_ RTC_GUARDED_BY(volume_settings_critsect_);
430 bool previous_frame_muted_ RTC_ACCESS_ON(encoder_queue_); 419 bool previous_frame_muted_ RTC_ACCESS_ON(encoder_queue_);
431 float _outputGain RTC_GUARDED_BY(volume_settings_critsect_); 420 float _outputGain RTC_GUARDED_BY(volume_settings_critsect_);
432 // VoeRTP_RTCP 421 // VoeRTP_RTCP
433 // TODO(henrika): can today be accessed on the main thread and on the 422 // TODO(henrika): can today be accessed on the main thread and on the
434 // task queue; hence potential race. 423 // task queue; hence potential race.
435 bool _includeAudioLevelIndication; 424 bool _includeAudioLevelIndication;
436 size_t transport_overhead_per_packet_ 425 size_t transport_overhead_per_packet_
(...skipping 28 matching lines...) Expand all
465 454
466 bool encoder_queue_is_active_ RTC_GUARDED_BY(encoder_queue_lock_) = false; 455 bool encoder_queue_is_active_ RTC_GUARDED_BY(encoder_queue_lock_) = false;
467 456
468 rtc::TaskQueue* encoder_queue_ = nullptr; 457 rtc::TaskQueue* encoder_queue_ = nullptr;
469 }; 458 };
470 459
471 } // namespace voe 460 } // namespace voe
472 } // namespace webrtc 461 } // namespace webrtc
473 462
474 #endif // VOICE_ENGINE_CHANNEL_H_ 463 #endif // VOICE_ENGINE_CHANNEL_H_
OLDNEW
« no previous file with comments | « voice_engine/BUILD.gn ('k') | voice_engine/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698