| 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/syncable.h" | 21 #include "webrtc/call/syncable.h" |
| 22 | 22 |
| 23 namespace webrtc { | 23 namespace webrtc { |
| 24 class PacketRouter; | 24 class PacketRouter; |
| 25 class RtcEventLog; | 25 class RtcEventLog; |
| 26 class RtpPacketReceived; |
| 26 | 27 |
| 27 namespace voe { | 28 namespace voe { |
| 28 class ChannelProxy; | 29 class ChannelProxy; |
| 29 } // namespace voe | 30 } // namespace voe |
| 30 | 31 |
| 31 namespace internal { | 32 namespace internal { |
| 32 class AudioSendStream; | 33 class AudioSendStream; |
| 33 | 34 |
| 34 class AudioReceiveStream final : public webrtc::AudioReceiveStream, | 35 class AudioReceiveStream final : public webrtc::AudioReceiveStream, |
| 35 public AudioMixer::Source, | 36 public AudioMixer::Source, |
| 36 public Syncable { | 37 public Syncable { |
| 37 public: | 38 public: |
| 38 AudioReceiveStream(PacketRouter* packet_router, | 39 AudioReceiveStream(PacketRouter* packet_router, |
| 39 const webrtc::AudioReceiveStream::Config& config, | 40 const webrtc::AudioReceiveStream::Config& config, |
| 40 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 41 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
| 41 webrtc::RtcEventLog* event_log); | 42 webrtc::RtcEventLog* event_log); |
| 42 ~AudioReceiveStream() override; | 43 ~AudioReceiveStream() override; |
| 43 | 44 |
| 44 // webrtc::AudioReceiveStream implementation. | 45 // webrtc::AudioReceiveStream implementation. |
| 45 void Start() override; | 46 void Start() override; |
| 46 void Stop() override; | 47 void Stop() override; |
| 47 webrtc::AudioReceiveStream::Stats GetStats() const override; | 48 webrtc::AudioReceiveStream::Stats GetStats() const override; |
| 48 void SetSink(std::unique_ptr<AudioSinkInterface> sink) override; | 49 void SetSink(std::unique_ptr<AudioSinkInterface> sink) override; |
| 49 void SetGain(float gain) override; | 50 void SetGain(float gain) override; |
| 50 | 51 |
| 52 // TODO(nisse): Intended to be part of an RtpPacketReceiver interface. |
| 53 void OnRtpPacket(const RtpPacketReceived& packet); |
| 54 |
| 51 // AudioMixer::Source | 55 // AudioMixer::Source |
| 52 AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz, | 56 AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz, |
| 53 AudioFrame* audio_frame) override; | 57 AudioFrame* audio_frame) override; |
| 54 int Ssrc() const override; | 58 int Ssrc() const override; |
| 55 int PreferredSampleRate() const override; | 59 int PreferredSampleRate() const override; |
| 56 | 60 |
| 57 // Syncable | 61 // Syncable |
| 58 int id() const override; | 62 int id() const override; |
| 59 rtc::Optional<Syncable::Info> GetInfo() const override; | 63 rtc::Optional<Syncable::Info> GetInfo() const override; |
| 60 uint32_t GetPlayoutTimestamp() const override; | 64 uint32_t GetPlayoutTimestamp() const override; |
| 61 void SetMinimumPlayoutDelay(int delay_ms) override; | 65 void SetMinimumPlayoutDelay(int delay_ms) override; |
| 62 | 66 |
| 63 void AssociateSendStream(AudioSendStream* send_stream); | 67 void AssociateSendStream(AudioSendStream* send_stream); |
| 64 void SignalNetworkState(NetworkState state); | 68 void SignalNetworkState(NetworkState state); |
| 65 bool DeliverRtcp(const uint8_t* packet, size_t length); | 69 bool DeliverRtcp(const uint8_t* packet, size_t length); |
| 66 bool DeliverRtp(const uint8_t* packet, | |
| 67 size_t length, | |
| 68 const PacketTime& packet_time); | |
| 69 const webrtc::AudioReceiveStream::Config& config() const; | 70 const webrtc::AudioReceiveStream::Config& config() const; |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 VoiceEngine* voice_engine() const; | 73 VoiceEngine* voice_engine() const; |
| 73 AudioState* audio_state() const; | 74 AudioState* audio_state() const; |
| 74 int SetVoiceEnginePlayout(bool playout); | 75 int SetVoiceEnginePlayout(bool playout); |
| 75 | 76 |
| 76 rtc::ThreadChecker worker_thread_checker_; | 77 rtc::ThreadChecker worker_thread_checker_; |
| 77 rtc::ThreadChecker module_process_thread_checker_; | 78 rtc::ThreadChecker module_process_thread_checker_; |
| 78 const webrtc::AudioReceiveStream::Config config_; | 79 const webrtc::AudioReceiveStream::Config config_; |
| 79 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 80 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
| 80 std::unique_ptr<voe::ChannelProxy> channel_proxy_; | 81 std::unique_ptr<voe::ChannelProxy> channel_proxy_; |
| 81 | 82 |
| 82 bool playing_ ACCESS_ON(worker_thread_checker_) = false; | 83 bool playing_ ACCESS_ON(worker_thread_checker_) = false; |
| 83 | 84 |
| 84 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream); | 85 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream); |
| 85 }; | 86 }; |
| 86 } // namespace internal | 87 } // namespace internal |
| 87 } // namespace webrtc | 88 } // namespace webrtc |
| 88 | 89 |
| 89 #endif // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ | 90 #endif // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ |
| OLD | NEW |