1 /* 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ 12 #define WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ 13 14 #include "webrtc/audio_receive_stream.h" 15 #include "webrtc/audio_state.h" 16 #include "webrtc/base/thread_checker.h" 17 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 18 19 namespace webrtc { 20 class CongestionController; 21 class RemoteBitrateEstimator; 22 23 namespace voe { 24 class ChannelProxy; 25 } // namespace voe 26 27 namespace internal { 28 29 class AudioReceiveStream final : public webrtc::AudioReceiveStream { 30 public: 31 AudioReceiveStream(CongestionController* congestion_controller, 32 const webrtc::AudioReceiveStream::Config& config, 33 const rtc::scoped_refptr<webrtc::AudioState>& audio_state); 34 ~AudioReceiveStream() override; 35 36 // webrtc::ReceiveStream implementation. 37 void Start() override; 38 void Stop() override; 39 void SignalNetworkState(NetworkState state) override; 40 bool DeliverRtcp(const uint8_t* packet, size_t length) override; 41 bool DeliverRtp(const uint8_t* packet, 42 size_t length, 43 const PacketTime& packet_time) override; 44 45 // webrtc::AudioReceiveStream implementation. 46 webrtc::AudioReceiveStream::Stats GetStats() const override; 47 48 void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) override; 49 50 const webrtc::AudioReceiveStream::Config& config() const; 51 52 private: 53 VoiceEngine* voice_engine() const; 54 55 rtc::ThreadChecker thread_checker_; 56 RemoteBitrateEstimator* remote_bitrate_estimator_ = nullptr; 57 const webrtc::AudioReceiveStream::Config config_; 58 rtc::scoped_refptr<webrtc::AudioState> audio_state_; 59 rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_; 60 rtc::scoped_ptr<voe::ChannelProxy> channel_proxy_; 61 62 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream); 63 }; 64 } // namespace internal 65 } // namespace webrtc 66 67 #endif // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ 68