| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 class ProcessThread; | 48 class ProcessThread; |
| 49 class RateLimiter; | 49 class RateLimiter; |
| 50 class ReceiveStatistics; | 50 class ReceiveStatistics; |
| 51 class RemoteNtpTimeEstimator; | 51 class RemoteNtpTimeEstimator; |
| 52 class RtcEventLog; | 52 class RtcEventLog; |
| 53 class RTPPayloadRegistry; | 53 class RTPPayloadRegistry; |
| 54 class RtpReceiver; | 54 class RtpReceiver; |
| 55 class RTPReceiverAudio; | 55 class RTPReceiverAudio; |
| 56 class RtpRtcp; | 56 class RtpRtcp; |
| 57 class TelephoneEventHandler; | 57 class TelephoneEventHandler; |
| 58 class VoEMediaProcess; | |
| 59 class VoERTPObserver; | 58 class VoERTPObserver; |
| 60 class VoiceEngineObserver; | 59 class VoiceEngineObserver; |
| 61 | 60 |
| 62 struct CallStatistics; | 61 struct CallStatistics; |
| 63 struct ReportBlock; | 62 struct ReportBlock; |
| 64 struct SenderInfo; | 63 struct SenderInfo; |
| 65 | 64 |
| 66 namespace voe { | 65 namespace voe { |
| 67 | 66 |
| 68 class OutputMixer; | 67 class OutputMixer; |
| 69 class RtcEventLogProxy; | 68 class RtcEventLogProxy; |
| 70 class RtcpRttStatsProxy; | 69 class RtcpRttStatsProxy; |
| 71 class RtpPacketSenderProxy; | 70 class RtpPacketSenderProxy; |
| 72 class Statistics; | 71 class Statistics; |
| 73 class StatisticsProxy; | 72 class StatisticsProxy; |
| 74 class TransportFeedbackProxy; | 73 class TransportFeedbackProxy; |
| 75 class TransmitMixer; | 74 class TransmitMixer; |
| 76 class TransportSequenceNumberProxy; | 75 class TransportSequenceNumberProxy; |
| 77 class VoERtcpObserver; | 76 class VoERtcpObserver; |
| 78 | 77 |
| 79 // Helper class to simplify locking scheme for members that are accessed from | 78 // Helper class to simplify locking scheme for members that are accessed from |
| 80 // multiple threads. | 79 // multiple threads. |
| 81 // Example: a member can be set on thread T1 and read by an internal audio | 80 // Example: a member can be set on thread T1 and read by an internal audio |
| 82 // thread T2. Accessing the member via this class ensures that we are | 81 // thread T2. Accessing the member via this class ensures that we are |
| 83 // safe and also avoid TSan v2 warnings. | 82 // safe and also avoid TSan v2 warnings. |
| 84 class ChannelState { | 83 class ChannelState { |
| 85 public: | 84 public: |
| 86 struct State { | 85 struct State { |
| 87 bool input_external_media = false; | |
| 88 bool output_file_playing = false; | 86 bool output_file_playing = false; |
| 89 bool input_file_playing = false; | 87 bool input_file_playing = false; |
| 90 bool playing = false; | 88 bool playing = false; |
| 91 bool sending = false; | 89 bool sending = false; |
| 92 }; | 90 }; |
| 93 | 91 |
| 94 ChannelState() {} | 92 ChannelState() {} |
| 95 virtual ~ChannelState() {} | 93 virtual ~ChannelState() {} |
| 96 | 94 |
| 97 void Reset() { | 95 void Reset() { |
| 98 rtc::CritScope lock(&lock_); | 96 rtc::CritScope lock(&lock_); |
| 99 state_ = State(); | 97 state_ = State(); |
| 100 } | 98 } |
| 101 | 99 |
| 102 State Get() const { | 100 State Get() const { |
| 103 rtc::CritScope lock(&lock_); | 101 rtc::CritScope lock(&lock_); |
| 104 return state_; | 102 return state_; |
| 105 } | 103 } |
| 106 | 104 |
| 107 void SetInputExternalMedia(bool enable) { | |
| 108 rtc::CritScope lock(&lock_); | |
| 109 state_.input_external_media = enable; | |
| 110 } | |
| 111 | |
| 112 void SetOutputFilePlaying(bool enable) { | 105 void SetOutputFilePlaying(bool enable) { |
| 113 rtc::CritScope lock(&lock_); | 106 rtc::CritScope lock(&lock_); |
| 114 state_.output_file_playing = enable; | 107 state_.output_file_playing = enable; |
| 115 } | 108 } |
| 116 | 109 |
| 117 void SetInputFilePlaying(bool enable) { | 110 void SetInputFilePlaying(bool enable) { |
| 118 rtc::CritScope lock(&lock_); | 111 rtc::CritScope lock(&lock_); |
| 119 state_.input_file_playing = enable; | 112 state_.input_file_playing = enable; |
| 120 } | 113 } |
| 121 | 114 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 int stopPosition, | 239 int stopPosition, |
| 247 const CodecInst* codecInst); | 240 const CodecInst* codecInst); |
| 248 int StopPlayingFileAsMicrophone(); | 241 int StopPlayingFileAsMicrophone(); |
| 249 int IsPlayingFileAsMicrophone() const; | 242 int IsPlayingFileAsMicrophone() const; |
| 250 int StartRecordingPlayout(const char* fileName, const CodecInst* codecInst); | 243 int StartRecordingPlayout(const char* fileName, const CodecInst* codecInst); |
| 251 int StartRecordingPlayout(OutStream* stream, const CodecInst* codecInst); | 244 int StartRecordingPlayout(OutStream* stream, const CodecInst* codecInst); |
| 252 int StopRecordingPlayout(); | 245 int StopRecordingPlayout(); |
| 253 | 246 |
| 254 void SetMixWithMicStatus(bool mix); | 247 void SetMixWithMicStatus(bool mix); |
| 255 | 248 |
| 256 // VoEExternalMediaProcessing | |
| 257 int RegisterExternalMediaProcessing(ProcessingTypes type, | |
| 258 VoEMediaProcess& processObject); | |
| 259 int DeRegisterExternalMediaProcessing(ProcessingTypes type); | |
| 260 int SetExternalMixing(bool enabled); | |
| 261 | |
| 262 // VoEVolumeControl | 249 // VoEVolumeControl |
| 263 int GetSpeechOutputLevel(uint32_t& level) const; | 250 int GetSpeechOutputLevel(uint32_t& level) const; |
| 264 int GetSpeechOutputLevelFullRange(uint32_t& level) const; | 251 int GetSpeechOutputLevelFullRange(uint32_t& level) const; |
| 265 int SetInputMute(bool enable); | 252 int SetInputMute(bool enable); |
| 266 bool InputMute() const; | 253 bool InputMute() const; |
| 267 int SetOutputVolumePan(float left, float right); | 254 int SetOutputVolumePan(float left, float right); |
| 268 int GetOutputVolumePan(float& left, float& right) const; | 255 int GetOutputVolumePan(float& left, float& right) const; |
| 269 int SetChannelOutputVolumeScaling(float scaling); | 256 int SetChannelOutputVolumeScaling(float scaling); |
| 270 int GetChannelOutputVolumeScaling(float& scaling) const; | 257 int GetChannelOutputVolumeScaling(float& scaling) const; |
| 271 | 258 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 void RecordFileEnded(int32_t id) override; | 372 void RecordFileEnded(int32_t id) override; |
| 386 | 373 |
| 387 uint32_t InstanceId() const { return _instanceId; } | 374 uint32_t InstanceId() const { return _instanceId; } |
| 388 int32_t ChannelId() const { return _channelId; } | 375 int32_t ChannelId() const { return _channelId; } |
| 389 bool Playing() const { return channel_state_.Get().playing; } | 376 bool Playing() const { return channel_state_.Get().playing; } |
| 390 bool Sending() const { return channel_state_.Get().sending; } | 377 bool Sending() const { return channel_state_.Get().sending; } |
| 391 bool ExternalTransport() const { | 378 bool ExternalTransport() const { |
| 392 rtc::CritScope cs(&_callbackCritSect); | 379 rtc::CritScope cs(&_callbackCritSect); |
| 393 return _externalTransport; | 380 return _externalTransport; |
| 394 } | 381 } |
| 395 bool ExternalMixing() const { return _externalMixing; } | |
| 396 RtpRtcp* RtpRtcpModulePtr() const { return _rtpRtcpModule.get(); } | 382 RtpRtcp* RtpRtcpModulePtr() const { return _rtpRtcpModule.get(); } |
| 397 int8_t OutputEnergyLevel() const { return _outputAudioLevel.Level(); } | 383 int8_t OutputEnergyLevel() const { return _outputAudioLevel.Level(); } |
| 398 uint32_t Demultiplex(const AudioFrame& audioFrame); | 384 uint32_t Demultiplex(const AudioFrame& audioFrame); |
| 399 // Demultiplex the data to the channel's |_audioFrame|. The difference | 385 // Demultiplex the data to the channel's |_audioFrame|. The difference |
| 400 // between this method and the overloaded method above is that |audio_data| | 386 // between this method and the overloaded method above is that |audio_data| |
| 401 // does not go through transmit_mixer and APM. | 387 // does not go through transmit_mixer and APM. |
| 402 void Demultiplex(const int16_t* audio_data, | 388 void Demultiplex(const int16_t* audio_data, |
| 403 int sample_rate, | 389 int sample_rate, |
| 404 size_t number_of_frames, | 390 size_t number_of_frames, |
| 405 size_t number_of_channels); | 391 size_t number_of_channels); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 AudioFrame _audioFrame; | 462 AudioFrame _audioFrame; |
| 477 // Downsamples to the codec rate if necessary. | 463 // Downsamples to the codec rate if necessary. |
| 478 PushResampler<int16_t> input_resampler_; | 464 PushResampler<int16_t> input_resampler_; |
| 479 std::unique_ptr<FilePlayer> input_file_player_; | 465 std::unique_ptr<FilePlayer> input_file_player_; |
| 480 std::unique_ptr<FilePlayer> output_file_player_; | 466 std::unique_ptr<FilePlayer> output_file_player_; |
| 481 std::unique_ptr<FileRecorder> output_file_recorder_; | 467 std::unique_ptr<FileRecorder> output_file_recorder_; |
| 482 int _inputFilePlayerId; | 468 int _inputFilePlayerId; |
| 483 int _outputFilePlayerId; | 469 int _outputFilePlayerId; |
| 484 int _outputFileRecorderId; | 470 int _outputFileRecorderId; |
| 485 bool _outputFileRecording; | 471 bool _outputFileRecording; |
| 486 bool _outputExternalMedia; | |
| 487 VoEMediaProcess* _inputExternalMediaCallbackPtr; | |
| 488 VoEMediaProcess* _outputExternalMediaCallbackPtr; | |
| 489 uint32_t _timeStamp; | 472 uint32_t _timeStamp; |
| 490 | 473 |
| 491 RemoteNtpTimeEstimator ntp_estimator_ GUARDED_BY(ts_stats_lock_); | 474 RemoteNtpTimeEstimator ntp_estimator_ GUARDED_BY(ts_stats_lock_); |
| 492 | 475 |
| 493 // Timestamp of the audio pulled from NetEq. | 476 // Timestamp of the audio pulled from NetEq. |
| 494 rtc::Optional<uint32_t> jitter_buffer_playout_timestamp_; | 477 rtc::Optional<uint32_t> jitter_buffer_playout_timestamp_; |
| 495 uint32_t playout_timestamp_rtp_ GUARDED_BY(video_sync_lock_); | 478 uint32_t playout_timestamp_rtp_ GUARDED_BY(video_sync_lock_); |
| 496 uint32_t playout_timestamp_rtcp_; | 479 uint32_t playout_timestamp_rtcp_; |
| 497 uint32_t playout_delay_ms_ GUARDED_BY(video_sync_lock_); | 480 uint32_t playout_delay_ms_ GUARDED_BY(video_sync_lock_); |
| 498 uint32_t _numberOfDiscardedPackets; | 481 uint32_t _numberOfDiscardedPackets; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 513 OutputMixer* _outputMixerPtr; | 496 OutputMixer* _outputMixerPtr; |
| 514 TransmitMixer* _transmitMixerPtr; | 497 TransmitMixer* _transmitMixerPtr; |
| 515 ProcessThread* _moduleProcessThreadPtr; | 498 ProcessThread* _moduleProcessThreadPtr; |
| 516 AudioDeviceModule* _audioDeviceModulePtr; | 499 AudioDeviceModule* _audioDeviceModulePtr; |
| 517 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base | 500 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base |
| 518 rtc::CriticalSection* _callbackCritSectPtr; // owned by base | 501 rtc::CriticalSection* _callbackCritSectPtr; // owned by base |
| 519 Transport* _transportPtr; // WebRtc socket or external transport | 502 Transport* _transportPtr; // WebRtc socket or external transport |
| 520 RmsLevel rms_level_; | 503 RmsLevel rms_level_; |
| 521 int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise | 504 int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise |
| 522 // VoEBase | 505 // VoEBase |
| 523 bool _externalMixing; | |
| 524 bool _mixFileWithMicrophone; | 506 bool _mixFileWithMicrophone; |
| 525 // VoEVolumeControl | 507 // VoEVolumeControl |
| 526 bool input_mute_ GUARDED_BY(volume_settings_critsect_); | 508 bool input_mute_ GUARDED_BY(volume_settings_critsect_); |
| 527 bool previous_frame_muted_; // Only accessed from PrepareEncodeAndSend(). | 509 bool previous_frame_muted_; // Only accessed from PrepareEncodeAndSend(). |
| 528 float _panLeft GUARDED_BY(volume_settings_critsect_); | 510 float _panLeft GUARDED_BY(volume_settings_critsect_); |
| 529 float _panRight GUARDED_BY(volume_settings_critsect_); | 511 float _panRight GUARDED_BY(volume_settings_critsect_); |
| 530 float _outputGain GUARDED_BY(volume_settings_critsect_); | 512 float _outputGain GUARDED_BY(volume_settings_critsect_); |
| 531 // VoeRTP_RTCP | 513 // VoeRTP_RTCP |
| 532 uint32_t _lastLocalTimeStamp; | 514 uint32_t _lastLocalTimeStamp; |
| 533 int8_t _lastPayloadType; | 515 int8_t _lastPayloadType; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 554 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; | 536 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; |
| 555 | 537 |
| 556 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. | 538 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. |
| 557 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 539 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
| 558 }; | 540 }; |
| 559 | 541 |
| 560 } // namespace voe | 542 } // namespace voe |
| 561 } // namespace webrtc | 543 } // namespace webrtc |
| 562 | 544 |
| 563 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ | 545 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ |
| OLD | NEW |