| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // 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 |
| 82 // safe and also avoid TSan v2 warnings. | 82 // safe and also avoid TSan v2 warnings. |
| 83 class ChannelState { | 83 class ChannelState { |
| 84 public: | 84 public: |
| 85 struct State { | 85 struct State { |
| 86 bool input_external_media = false; | 86 bool input_external_media = false; |
| 87 bool output_file_playing = false; | 87 bool output_file_playing = false; |
| 88 bool input_file_playing = false; | 88 bool input_file_playing = false; |
| 89 bool playing = false; | 89 bool playing = false; |
| 90 bool sending = false; | 90 bool sending = false; |
| 91 bool receiving = false; | |
| 92 }; | 91 }; |
| 93 | 92 |
| 94 ChannelState() {} | 93 ChannelState() {} |
| 95 virtual ~ChannelState() {} | 94 virtual ~ChannelState() {} |
| 96 | 95 |
| 97 void Reset() { | 96 void Reset() { |
| 98 rtc::CritScope lock(&lock_); | 97 rtc::CritScope lock(&lock_); |
| 99 state_ = State(); | 98 state_ = State(); |
| 100 } | 99 } |
| 101 | 100 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 122 void SetPlaying(bool enable) { | 121 void SetPlaying(bool enable) { |
| 123 rtc::CritScope lock(&lock_); | 122 rtc::CritScope lock(&lock_); |
| 124 state_.playing = enable; | 123 state_.playing = enable; |
| 125 } | 124 } |
| 126 | 125 |
| 127 void SetSending(bool enable) { | 126 void SetSending(bool enable) { |
| 128 rtc::CritScope lock(&lock_); | 127 rtc::CritScope lock(&lock_); |
| 129 state_.sending = enable; | 128 state_.sending = enable; |
| 130 } | 129 } |
| 131 | 130 |
| 132 void SetReceiving(bool enable) { | |
| 133 rtc::CritScope lock(&lock_); | |
| 134 state_.receiving = enable; | |
| 135 } | |
| 136 | |
| 137 private: | 131 private: |
| 138 rtc::CriticalSection lock_; | 132 rtc::CriticalSection lock_; |
| 139 State state_; | 133 State state_; |
| 140 }; | 134 }; |
| 141 | 135 |
| 142 class Channel | 136 class Channel |
| 143 : public RtpData, | 137 : public RtpData, |
| 144 public RtpFeedback, | 138 public RtpFeedback, |
| 145 public FileCallback, // receiving notification from file player & | 139 public FileCallback, // receiving notification from file player & |
| 146 // recorder | 140 // recorder |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // go. | 176 // go. |
| 183 const rtc::scoped_refptr<AudioDecoderFactory>& GetAudioDecoderFactory() const; | 177 const rtc::scoped_refptr<AudioDecoderFactory>& GetAudioDecoderFactory() const; |
| 184 | 178 |
| 185 // API methods | 179 // API methods |
| 186 | 180 |
| 187 // VoEBase | 181 // VoEBase |
| 188 int32_t StartPlayout(); | 182 int32_t StartPlayout(); |
| 189 int32_t StopPlayout(); | 183 int32_t StopPlayout(); |
| 190 int32_t StartSend(); | 184 int32_t StartSend(); |
| 191 int32_t StopSend(); | 185 int32_t StopSend(); |
| 192 int32_t StartReceiving(); | 186 void ResetDiscardedPacketCount(); |
| 193 int32_t StopReceiving(); | |
| 194 | |
| 195 int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer); | 187 int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer); |
| 196 int32_t DeRegisterVoiceEngineObserver(); | 188 int32_t DeRegisterVoiceEngineObserver(); |
| 197 | 189 |
| 198 // VoECodec | 190 // VoECodec |
| 199 int32_t GetSendCodec(CodecInst& codec); | 191 int32_t GetSendCodec(CodecInst& codec); |
| 200 int32_t GetRecCodec(CodecInst& codec); | 192 int32_t GetRecCodec(CodecInst& codec); |
| 201 int32_t SetSendCodec(const CodecInst& codec); | 193 int32_t SetSendCodec(const CodecInst& codec); |
| 202 void SetBitRate(int bitrate_bps); | 194 void SetBitRate(int bitrate_bps); |
| 203 int32_t SetVADStatus(bool enableVAD, ACMVADMode mode, bool disableDTX); | 195 int32_t SetVADStatus(bool enableVAD, ACMVADMode mode, bool disableDTX); |
| 204 int32_t GetVADStatus(bool& enabledVAD, ACMVADMode& mode, bool& disabledDTX); | 196 int32_t GetVADStatus(bool& enabledVAD, ACMVADMode& mode, bool& disabledDTX); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // From FileCallback | 378 // From FileCallback |
| 387 void PlayNotification(int32_t id, uint32_t durationMs) override; | 379 void PlayNotification(int32_t id, uint32_t durationMs) override; |
| 388 void RecordNotification(int32_t id, uint32_t durationMs) override; | 380 void RecordNotification(int32_t id, uint32_t durationMs) override; |
| 389 void PlayFileEnded(int32_t id) override; | 381 void PlayFileEnded(int32_t id) override; |
| 390 void RecordFileEnded(int32_t id) override; | 382 void RecordFileEnded(int32_t id) override; |
| 391 | 383 |
| 392 uint32_t InstanceId() const { return _instanceId; } | 384 uint32_t InstanceId() const { return _instanceId; } |
| 393 int32_t ChannelId() const { return _channelId; } | 385 int32_t ChannelId() const { return _channelId; } |
| 394 bool Playing() const { return channel_state_.Get().playing; } | 386 bool Playing() const { return channel_state_.Get().playing; } |
| 395 bool Sending() const { return channel_state_.Get().sending; } | 387 bool Sending() const { return channel_state_.Get().sending; } |
| 396 bool Receiving() const { return channel_state_.Get().receiving; } | |
| 397 bool ExternalTransport() const { | 388 bool ExternalTransport() const { |
| 398 rtc::CritScope cs(&_callbackCritSect); | 389 rtc::CritScope cs(&_callbackCritSect); |
| 399 return _externalTransport; | 390 return _externalTransport; |
| 400 } | 391 } |
| 401 bool ExternalMixing() const { return _externalMixing; } | 392 bool ExternalMixing() const { return _externalMixing; } |
| 402 RtpRtcp* RtpRtcpModulePtr() const { return _rtpRtcpModule.get(); } | 393 RtpRtcp* RtpRtcpModulePtr() const { return _rtpRtcpModule.get(); } |
| 403 int8_t OutputEnergyLevel() const { return _outputAudioLevel.Level(); } | 394 int8_t OutputEnergyLevel() const { return _outputAudioLevel.Level(); } |
| 404 uint32_t Demultiplex(const AudioFrame& audioFrame); | 395 uint32_t Demultiplex(const AudioFrame& audioFrame); |
| 405 // Demultiplex the data to the channel's |_audioFrame|. The difference | 396 // Demultiplex the data to the channel's |_audioFrame|. The difference |
| 406 // between this method and the overloaded method above is that |audio_data| | 397 // between this method and the overloaded method above is that |audio_data| |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; | 545 std::unique_ptr<RateLimiter> retransmission_rate_limiter_; |
| 555 | 546 |
| 556 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. | 547 // TODO(ossu): Remove once GetAudioDecoderFactory() is no longer needed. |
| 557 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 548 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
| 558 }; | 549 }; |
| 559 | 550 |
| 560 } // namespace voe | 551 } // namespace voe |
| 561 } // namespace webrtc | 552 } // namespace webrtc |
| 562 | 553 |
| 563 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ | 554 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_H_ |
| OLD | NEW |