| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
| 11 #ifndef WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ | 11 #ifndef WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ |
| 12 #define WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ | 12 #define WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 #include "webrtc/api/audio/audio_mixer.h" | 16 #include "webrtc/api/audio/audio_mixer.h" |
| 17 #include "webrtc/audio/audio_state.h" | 17 #include "webrtc/audio/audio_state.h" |
| 18 #include "webrtc/base/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
| 19 #include "webrtc/base/thread_checker.h" | 19 #include "webrtc/base/thread_checker.h" |
| 20 #include "webrtc/call/audio_receive_stream.h" | 20 #include "webrtc/call/audio_receive_stream.h" |
| 21 #include "webrtc/call/audio_state.h" | 21 #include "webrtc/call/syncable.h" |
| 22 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 22 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 class PacketRouter; |
| 25 class RemoteBitrateEstimator; | 26 class RemoteBitrateEstimator; |
| 26 class RtcEventLog; | 27 class RtcEventLog; |
| 27 class PacketRouter; | |
| 28 | 28 |
| 29 namespace voe { | 29 namespace voe { |
| 30 class ChannelProxy; | 30 class ChannelProxy; |
| 31 } // namespace voe | 31 } // namespace voe |
| 32 | 32 |
| 33 namespace internal { | 33 namespace internal { |
| 34 class AudioSendStream; | 34 class AudioSendStream; |
| 35 | 35 |
| 36 class AudioReceiveStream final : public webrtc::AudioReceiveStream, | 36 class AudioReceiveStream final : public webrtc::AudioReceiveStream, |
| 37 public AudioMixer::Source { | 37 public AudioMixer::Source, |
| 38 public Syncable { |
| 38 public: | 39 public: |
| 39 AudioReceiveStream(PacketRouter* packet_router, | 40 AudioReceiveStream(PacketRouter* packet_router, |
| 40 RemoteBitrateEstimator* remote_bitrate_estimator, | 41 RemoteBitrateEstimator* remote_bitrate_estimator, |
| 41 const webrtc::AudioReceiveStream::Config& config, | 42 const webrtc::AudioReceiveStream::Config& config, |
| 42 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 43 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
| 43 webrtc::RtcEventLog* event_log); | 44 webrtc::RtcEventLog* event_log); |
| 44 ~AudioReceiveStream() override; | 45 ~AudioReceiveStream() override; |
| 45 | 46 |
| 46 // webrtc::AudioReceiveStream implementation. | 47 // webrtc::AudioReceiveStream implementation. |
| 47 void Start() override; | 48 void Start() override; |
| 48 void Stop() override; | 49 void Stop() override; |
| 49 webrtc::AudioReceiveStream::Stats GetStats() const override; | 50 webrtc::AudioReceiveStream::Stats GetStats() const override; |
| 50 void SetSink(std::unique_ptr<AudioSinkInterface> sink) override; | 51 void SetSink(std::unique_ptr<AudioSinkInterface> sink) override; |
| 51 void SetGain(float gain) override; | 52 void SetGain(float gain) override; |
| 52 | 53 |
| 54 // AudioMixer::Source |
| 55 AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz, |
| 56 AudioFrame* audio_frame) override; |
| 57 int Ssrc() const override; |
| 58 int PreferredSampleRate() const override; |
| 59 |
| 60 // Syncable |
| 61 int id() const override; |
| 62 rtc::Optional<Syncable::Info> GetInfo() const override; |
| 63 uint32_t GetPlayoutTimestamp() const override; |
| 64 void SetMinimumPlayoutDelay(int delay_ms) override; |
| 65 |
| 53 void AssociateSendStream(AudioSendStream* send_stream); | 66 void AssociateSendStream(AudioSendStream* send_stream); |
| 54 void SignalNetworkState(NetworkState state); | 67 void SignalNetworkState(NetworkState state); |
| 55 bool DeliverRtcp(const uint8_t* packet, size_t length); | 68 bool DeliverRtcp(const uint8_t* packet, size_t length); |
| 56 bool DeliverRtp(const uint8_t* packet, | 69 bool DeliverRtp(const uint8_t* packet, |
| 57 size_t length, | 70 size_t length, |
| 58 const PacketTime& packet_time); | 71 const PacketTime& packet_time); |
| 59 const webrtc::AudioReceiveStream::Config& config() const; | 72 const webrtc::AudioReceiveStream::Config& config() const; |
| 60 | 73 |
| 61 // AudioMixer::Source | |
| 62 AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz, | |
| 63 AudioFrame* audio_frame) override; | |
| 64 int PreferredSampleRate() const override; | |
| 65 int Ssrc() const override; | |
| 66 | |
| 67 private: | 74 private: |
| 68 VoiceEngine* voice_engine() const; | 75 VoiceEngine* voice_engine() const; |
| 69 AudioState* audio_state() const; | 76 AudioState* audio_state() const; |
| 70 int SetVoiceEnginePlayout(bool playout); | 77 int SetVoiceEnginePlayout(bool playout); |
| 71 | 78 |
| 72 rtc::ThreadChecker thread_checker_; | 79 rtc::ThreadChecker thread_checker_; |
| 73 RemoteBitrateEstimator* const remote_bitrate_estimator_; | 80 RemoteBitrateEstimator* const remote_bitrate_estimator_; |
| 74 const webrtc::AudioReceiveStream::Config config_; | 81 const webrtc::AudioReceiveStream::Config config_; |
| 75 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 82 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
| 76 std::unique_ptr<RtpHeaderParser> rtp_header_parser_; | 83 std::unique_ptr<RtpHeaderParser> rtp_header_parser_; |
| 77 std::unique_ptr<voe::ChannelProxy> channel_proxy_; | 84 std::unique_ptr<voe::ChannelProxy> channel_proxy_; |
| 78 | 85 |
| 79 bool playing_ ACCESS_ON(thread_checker_) = false; | 86 bool playing_ ACCESS_ON(thread_checker_) = false; |
| 80 | 87 |
| 81 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream); | 88 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream); |
| 82 }; | 89 }; |
| 83 } // namespace internal | 90 } // namespace internal |
| 84 } // namespace webrtc | 91 } // namespace webrtc |
| 85 | 92 |
| 86 #endif // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ | 93 #endif // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ |
| OLD | NEW |