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