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 #include <vector> |
15 | 16 |
16 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
17 #include "webrtc/base/thread_checker.h" | 18 #include "webrtc/base/thread_checker.h" |
18 #include "webrtc/call/audio_send_stream.h" | 19 #include "webrtc/call/audio_send_stream.h" |
19 #include "webrtc/call/audio_state.h" | 20 #include "webrtc/call/audio_state.h" |
20 #include "webrtc/call/bitrate_allocator.h" | 21 #include "webrtc/call/bitrate_allocator.h" |
| 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
21 | 23 |
22 namespace webrtc { | 24 namespace webrtc { |
23 class CongestionController; | 25 class CongestionController; |
24 class VoiceEngine; | 26 class VoiceEngine; |
25 class RtcEventLog; | 27 class RtcEventLog; |
26 class RtcpRttStats; | 28 class RtcpRttStats; |
27 class PacketRouter; | 29 class PacketRouter; |
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 final : public webrtc::AudioSendStream, | 36 class AudioSendStream final : public webrtc::AudioSendStream, |
35 public webrtc::BitrateAllocatorObserver { | 37 public webrtc::BitrateAllocatorObserver, |
| 38 public webrtc::TransportFeedbackAdapterObserver { |
36 public: | 39 public: |
37 AudioSendStream(const webrtc::AudioSendStream::Config& config, | 40 AudioSendStream(const webrtc::AudioSendStream::Config& config, |
38 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 41 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
39 rtc::TaskQueue* worker_queue, | 42 rtc::TaskQueue* worker_queue, |
40 PacketRouter* packet_router, | 43 PacketRouter* packet_router, |
41 CongestionController* congestion_controller, | 44 CongestionController* congestion_controller, |
42 BitrateAllocator* bitrate_allocator, | 45 BitrateAllocator* bitrate_allocator, |
43 RtcEventLog* event_log, | 46 RtcEventLog* event_log, |
44 RtcpRttStats* rtcp_rtt_stats); | 47 RtcpRttStats* rtcp_rtt_stats); |
45 ~AudioSendStream() override; | 48 ~AudioSendStream() override; |
46 | 49 |
47 // webrtc::AudioSendStream implementation. | 50 // webrtc::AudioSendStream implementation. |
48 void Start() override; | 51 void Start() override; |
49 void Stop() override; | 52 void Stop() override; |
50 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, | 53 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, |
51 int duration_ms) override; | 54 int duration_ms) override; |
52 void SetMuted(bool muted) override; | 55 void SetMuted(bool muted) override; |
53 webrtc::AudioSendStream::Stats GetStats() const override; | 56 webrtc::AudioSendStream::Stats GetStats() const override; |
54 | 57 |
55 void SignalNetworkState(NetworkState state); | 58 void SignalNetworkState(NetworkState state); |
56 bool DeliverRtcp(const uint8_t* packet, size_t length); | 59 bool DeliverRtcp(const uint8_t* packet, size_t length); |
57 | 60 |
58 // Implements BitrateAllocatorObserver. | 61 // Implements BitrateAllocatorObserver. |
59 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, | 62 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, |
60 uint8_t fraction_loss, | 63 uint8_t fraction_loss, |
61 int64_t rtt, | 64 int64_t rtt, |
62 int64_t probing_interval_ms) override; | 65 int64_t probing_interval_ms) override; |
63 | 66 |
| 67 // From TransportFeedbackAdapterObserver |
| 68 void OnPacketAdded(uint32_t ssrc, |
| 69 uint16_t transport_sequence_number) override; |
| 70 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override; |
| 71 |
64 const webrtc::AudioSendStream::Config& config() const; | 72 const webrtc::AudioSendStream::Config& config() const; |
65 void SetTransportOverhead(int transport_overhead_per_packet); | 73 void SetTransportOverhead(int transport_overhead_per_packet); |
66 | 74 |
67 private: | 75 private: |
68 VoiceEngine* voice_engine() const; | 76 VoiceEngine* voice_engine() const; |
69 | 77 |
70 bool SetupSendCodec(); | 78 bool SetupSendCodec(); |
71 | 79 |
72 rtc::ThreadChecker thread_checker_; | 80 rtc::ThreadChecker thread_checker_; |
73 rtc::TaskQueue* worker_queue_; | 81 rtc::TaskQueue* worker_queue_; |
74 const webrtc::AudioSendStream::Config config_; | 82 const webrtc::AudioSendStream::Config config_; |
75 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 83 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
76 std::unique_ptr<voe::ChannelProxy> channel_proxy_; | 84 std::unique_ptr<voe::ChannelProxy> channel_proxy_; |
77 | 85 |
78 BitrateAllocator* const bitrate_allocator_; | 86 BitrateAllocator* const bitrate_allocator_; |
79 CongestionController* const congestion_controller_; | 87 CongestionController* const congestion_controller_; |
80 | 88 |
| 89 rtc::CriticalSection packets_sent_since_last_feedback_cs_; |
| 90 std::vector<uint16_t> packets_sent_since_last_feedback_ |
| 91 GUARDED_BY(&packets_sent_since_last_feedback_cs_); |
| 92 |
81 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); | 93 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); |
82 }; | 94 }; |
83 } // namespace internal | 95 } // namespace internal |
84 } // namespace webrtc | 96 } // namespace webrtc |
85 | 97 |
86 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ | 98 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ |
OLD | NEW |