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_SEND_STREAM_H_ | 11 #ifndef WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ |
12 #define WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ | 12 #define WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
17 #include "webrtc/base/thread_checker.h" | 17 #include "webrtc/base/thread_checker.h" |
18 #include "webrtc/call/audio_send_stream.h" | 18 #include "webrtc/call/audio_send_stream.h" |
19 #include "webrtc/call/audio_state.h" | 19 #include "webrtc/call/audio_state.h" |
20 #include "webrtc/call/bitrate_allocator.h" | 20 #include "webrtc/call/bitrate_allocator.h" |
21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | |
22 #include "webrtc/voice_engine/transport_feedback_packet_loss_tracker.h" | |
21 | 23 |
22 namespace webrtc { | 24 namespace webrtc { |
23 class SendSideCongestionController; | 25 class SendSideCongestionController; |
minyue-webrtc
2017/03/22 07:51:39
just a note: please try rebasing in a separate pat
elad.alon_webrtc.org
2017/03/22 09:36:30
Sure, will do.
| |
24 class VoiceEngine; | 26 class VoiceEngine; |
25 class RtcEventLog; | 27 class RtcEventLog; |
26 class RtcpBandwidthObserver; | 28 class RtcpBandwidthObserver; |
27 class RtcpRttStats; | 29 class RtcpRttStats; |
28 class PacketRouter; | 30 class PacketRouter; |
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 final : public webrtc::AudioSendStream, | 37 class AudioSendStream final : public webrtc::AudioSendStream, |
36 public webrtc::BitrateAllocatorObserver { | 38 public webrtc::BitrateAllocatorObserver, |
39 public webrtc::TransportFeedbackAdapterObserver { | |
37 public: | 40 public: |
38 AudioSendStream(const webrtc::AudioSendStream::Config& config, | 41 AudioSendStream(const webrtc::AudioSendStream::Config& config, |
39 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 42 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
40 rtc::TaskQueue* worker_queue, | 43 rtc::TaskQueue* worker_queue, |
41 PacketRouter* packet_router, | 44 PacketRouter* packet_router, |
42 SendSideCongestionController* send_side_cc, | 45 SendSideCongestionController* send_side_cc, |
43 BitrateAllocator* bitrate_allocator, | 46 BitrateAllocator* bitrate_allocator, |
44 RtcEventLog* event_log, | 47 RtcEventLog* event_log, |
45 RtcpRttStats* rtcp_rtt_stats); | 48 RtcpRttStats* rtcp_rtt_stats); |
46 ~AudioSendStream() override; | 49 ~AudioSendStream() override; |
47 | 50 |
48 // webrtc::AudioSendStream implementation. | 51 // webrtc::AudioSendStream implementation. |
49 void Start() override; | 52 void Start() override; |
50 void Stop() override; | 53 void Stop() override; |
51 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, | 54 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, |
52 int duration_ms) override; | 55 int duration_ms) override; |
53 void SetMuted(bool muted) override; | 56 void SetMuted(bool muted) override; |
54 webrtc::AudioSendStream::Stats GetStats() const override; | 57 webrtc::AudioSendStream::Stats GetStats() const override; |
55 | 58 |
56 void SignalNetworkState(NetworkState state); | 59 void SignalNetworkState(NetworkState state); |
57 bool DeliverRtcp(const uint8_t* packet, size_t length); | 60 bool DeliverRtcp(const uint8_t* packet, size_t length); |
58 | 61 |
59 // Implements BitrateAllocatorObserver. | 62 // Implements BitrateAllocatorObserver. |
60 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, | 63 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, |
61 uint8_t fraction_loss, | 64 uint8_t fraction_loss, |
62 int64_t rtt, | 65 int64_t rtt, |
63 int64_t probing_interval_ms) override; | 66 int64_t probing_interval_ms) override; |
64 | 67 |
68 // From TransportFeedbackAdapterObserver | |
69 void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override; | |
70 void OnNewTransportFeedbackVector( | |
71 const std::vector<PacketFeedback>& packet_feedback_vector) override; | |
72 | |
65 const webrtc::AudioSendStream::Config& config() const; | 73 const webrtc::AudioSendStream::Config& config() const; |
66 void SetTransportOverhead(int transport_overhead_per_packet); | 74 void SetTransportOverhead(int transport_overhead_per_packet); |
67 | 75 |
68 private: | 76 private: |
69 VoiceEngine* voice_engine() const; | 77 VoiceEngine* voice_engine() const; |
70 | 78 |
71 bool SetupSendCodec(); | 79 bool SetupSendCodec(); |
72 | 80 |
81 const Clock* const clock_; | |
73 rtc::ThreadChecker thread_checker_; | 82 rtc::ThreadChecker thread_checker_; |
74 rtc::TaskQueue* worker_queue_; | 83 rtc::TaskQueue* worker_queue_; |
75 const webrtc::AudioSendStream::Config config_; | 84 const webrtc::AudioSendStream::Config config_; |
76 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 85 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
77 std::unique_ptr<voe::ChannelProxy> channel_proxy_; | 86 std::unique_ptr<voe::ChannelProxy> channel_proxy_; |
78 | 87 |
79 BitrateAllocator* const bitrate_allocator_; | 88 BitrateAllocator* const bitrate_allocator_; |
80 SendSideCongestionController* const send_side_cc_; | 89 SendSideCongestionController* const send_side_cc_; |
81 std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; | 90 std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; |
82 | 91 |
92 rtc::CriticalSection packet_loss_tracker_cs_; | |
93 TransportFeedbackPacketLossTracker packet_loss_tracker_ | |
94 GUARDED_BY(&packet_loss_tracker_cs_); | |
95 | |
83 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); | 96 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); |
84 }; | 97 }; |
85 } // namespace internal | 98 } // namespace internal |
86 } // namespace webrtc | 99 } // namespace webrtc |
87 | 100 |
88 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ | 101 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ |
OLD | NEW |