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