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_packet_sink_interface.h" | 22 #include "webrtc/call/rtp_packet_sink_interface.h" |
23 #include "webrtc/call/syncable.h" | 23 #include "webrtc/call/syncable.h" |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 class PacketRouter; | 26 class PacketRouter; |
27 class RtcEventLog; | 27 class RtcEventLog; |
28 class RtpPacketReceived; | 28 class RtpPacketReceived; |
| 29 class RtpStreamReceiverControllerInterface; |
| 30 class RtpStreamReceiverInterface; |
29 | 31 |
30 namespace voe { | 32 namespace voe { |
31 class ChannelProxy; | 33 class ChannelProxy; |
32 } // namespace voe | 34 } // namespace voe |
33 | 35 |
34 namespace internal { | 36 namespace internal { |
35 class AudioSendStream; | 37 class AudioSendStream; |
36 | 38 |
37 class AudioReceiveStream final : public webrtc::AudioReceiveStream, | 39 class AudioReceiveStream final : public webrtc::AudioReceiveStream, |
38 public AudioMixer::Source, | 40 public AudioMixer::Source, |
39 public Syncable, | 41 public Syncable { |
40 public RtpPacketSinkInterface { | |
41 public: | 42 public: |
42 AudioReceiveStream(PacketRouter* packet_router, | 43 AudioReceiveStream(RtpStreamReceiverControllerInterface* receiver_controller, |
| 44 PacketRouter* packet_router, |
43 const webrtc::AudioReceiveStream::Config& config, | 45 const webrtc::AudioReceiveStream::Config& config, |
44 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 46 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
45 webrtc::RtcEventLog* event_log); | 47 webrtc::RtcEventLog* event_log); |
46 ~AudioReceiveStream() override; | 48 ~AudioReceiveStream() override; |
47 | 49 |
48 // webrtc::AudioReceiveStream implementation. | 50 // webrtc::AudioReceiveStream implementation. |
49 void Start() override; | 51 void Start() override; |
50 void Stop() override; | 52 void Stop() override; |
51 webrtc::AudioReceiveStream::Stats GetStats() const override; | 53 webrtc::AudioReceiveStream::Stats GetStats() const override; |
52 int GetOutputLevel() const override; | 54 int GetOutputLevel() const override; |
53 void SetSink(std::unique_ptr<AudioSinkInterface> sink) override; | 55 void SetSink(std::unique_ptr<AudioSinkInterface> sink) override; |
54 void SetGain(float gain) override; | 56 void SetGain(float gain) override; |
55 std::vector<webrtc::RtpSource> GetSources() const override; | 57 std::vector<webrtc::RtpSource> GetSources() const override; |
56 | 58 |
57 // RtpPacketSinkInterface. | 59 // TODO(nisse): We don't formally implement RtpPacketSinkInterface, and this |
58 void OnRtpPacket(const RtpPacketReceived& packet) override; | 60 // method shouldn't be needed. But it's currently used by the |
| 61 // AudioReceiveStreamTest.ReceiveRtpPacket unittest. Figure out if that test |
| 62 // shuld be refactored or deleted, and then delete this method. |
| 63 void OnRtpPacket(const RtpPacketReceived& packet); |
59 | 64 |
60 // AudioMixer::Source | 65 // AudioMixer::Source |
61 AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz, | 66 AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz, |
62 AudioFrame* audio_frame) override; | 67 AudioFrame* audio_frame) override; |
63 int Ssrc() const override; | 68 int Ssrc() const override; |
64 int PreferredSampleRate() const override; | 69 int PreferredSampleRate() const override; |
65 | 70 |
66 // Syncable | 71 // Syncable |
67 int id() const override; | 72 int id() const override; |
68 rtc::Optional<Syncable::Info> GetInfo() const override; | 73 rtc::Optional<Syncable::Info> GetInfo() const override; |
(...skipping 11 matching lines...) Expand all Loading... |
80 int SetVoiceEnginePlayout(bool playout); | 85 int SetVoiceEnginePlayout(bool playout); |
81 | 86 |
82 rtc::ThreadChecker worker_thread_checker_; | 87 rtc::ThreadChecker worker_thread_checker_; |
83 rtc::ThreadChecker module_process_thread_checker_; | 88 rtc::ThreadChecker module_process_thread_checker_; |
84 const webrtc::AudioReceiveStream::Config config_; | 89 const webrtc::AudioReceiveStream::Config config_; |
85 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 90 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
86 std::unique_ptr<voe::ChannelProxy> channel_proxy_; | 91 std::unique_ptr<voe::ChannelProxy> channel_proxy_; |
87 | 92 |
88 bool playing_ ACCESS_ON(worker_thread_checker_) = false; | 93 bool playing_ ACCESS_ON(worker_thread_checker_) = false; |
89 | 94 |
| 95 std::unique_ptr<RtpStreamReceiverInterface> rtp_stream_receiver_; |
| 96 |
90 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream); | 97 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioReceiveStream); |
91 }; | 98 }; |
92 } // namespace internal | 99 } // namespace internal |
93 } // namespace webrtc | 100 } // namespace webrtc |
94 | 101 |
95 #endif // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ | 102 #endif // WEBRTC_AUDIO_AUDIO_RECEIVE_STREAM_H_ |
OLD | NEW |