| 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" |
| 23 #include "webrtc/voice_engine/transport_feedback_packet_loss_tracker.h" |
| 21 | 24 |
| 22 namespace webrtc { | 25 namespace webrtc { |
| 23 class SendSideCongestionController; | 26 class SendSideCongestionController; |
| 24 class VoiceEngine; | 27 class VoiceEngine; |
| 25 class RtcEventLog; | 28 class RtcEventLog; |
| 26 class RtcpBandwidthObserver; | 29 class RtcpBandwidthObserver; |
| 27 class RtcpRttStats; | 30 class RtcpRttStats; |
| 28 class PacketRouter; | 31 class PacketRouter; |
| 29 | 32 |
| 30 namespace voe { | 33 namespace voe { |
| 31 class ChannelProxy; | 34 class ChannelProxy; |
| 32 } // namespace voe | 35 } // namespace voe |
| 33 | 36 |
| 34 namespace internal { | 37 namespace internal { |
| 35 class AudioSendStream final : public webrtc::AudioSendStream, | 38 class AudioSendStream final : public webrtc::AudioSendStream, |
| 36 public webrtc::BitrateAllocatorObserver { | 39 public webrtc::BitrateAllocatorObserver, |
| 40 public webrtc::PacketFeedbackObserver { |
| 37 public: | 41 public: |
| 38 AudioSendStream(const webrtc::AudioSendStream::Config& config, | 42 AudioSendStream(const webrtc::AudioSendStream::Config& config, |
| 39 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 43 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
| 40 rtc::TaskQueue* worker_queue, | 44 rtc::TaskQueue* worker_queue, |
| 41 PacketRouter* packet_router, | 45 PacketRouter* packet_router, |
| 42 SendSideCongestionController* send_side_cc, | 46 SendSideCongestionController* send_side_cc, |
| 43 BitrateAllocator* bitrate_allocator, | 47 BitrateAllocator* bitrate_allocator, |
| 44 RtcEventLog* event_log, | 48 RtcEventLog* event_log, |
| 45 RtcpRttStats* rtcp_rtt_stats); | 49 RtcpRttStats* rtcp_rtt_stats); |
| 46 ~AudioSendStream() override; | 50 ~AudioSendStream() override; |
| 47 | 51 |
| 48 // webrtc::AudioSendStream implementation. | 52 // webrtc::AudioSendStream implementation. |
| 49 void Start() override; | 53 void Start() override; |
| 50 void Stop() override; | 54 void Stop() override; |
| 51 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, | 55 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, |
| 52 int duration_ms) override; | 56 int duration_ms) override; |
| 53 void SetMuted(bool muted) override; | 57 void SetMuted(bool muted) override; |
| 54 webrtc::AudioSendStream::Stats GetStats() const override; | 58 webrtc::AudioSendStream::Stats GetStats() const override; |
| 55 | 59 |
| 56 void SignalNetworkState(NetworkState state); | 60 void SignalNetworkState(NetworkState state); |
| 57 bool DeliverRtcp(const uint8_t* packet, size_t length); | 61 bool DeliverRtcp(const uint8_t* packet, size_t length); |
| 58 | 62 |
| 59 // Implements BitrateAllocatorObserver. | 63 // Implements BitrateAllocatorObserver. |
| 60 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, | 64 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, |
| 61 uint8_t fraction_loss, | 65 uint8_t fraction_loss, |
| 62 int64_t rtt, | 66 int64_t rtt, |
| 63 int64_t probing_interval_ms) override; | 67 int64_t probing_interval_ms) override; |
| 64 | 68 |
| 69 // From PacketFeedbackObserver. |
| 70 void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override; |
| 71 void OnPacketFeedbackVector( |
| 72 const std::vector<PacketFeedback>& packet_feedback_vector) override; |
| 73 |
| 65 const webrtc::AudioSendStream::Config& config() const; | 74 const webrtc::AudioSendStream::Config& config() const; |
| 66 void SetTransportOverhead(int transport_overhead_per_packet); | 75 void SetTransportOverhead(int transport_overhead_per_packet); |
| 67 | 76 |
| 68 private: | 77 private: |
| 69 VoiceEngine* voice_engine() const; | 78 VoiceEngine* voice_engine() const; |
| 70 | 79 |
| 71 bool SetupSendCodec(); | 80 bool SetupSendCodec(); |
| 72 | 81 |
| 73 rtc::ThreadChecker thread_checker_; | 82 rtc::ThreadChecker worker_thread_checker_; |
| 83 rtc::ThreadChecker pacer_thread_checker_; |
| 74 rtc::TaskQueue* worker_queue_; | 84 rtc::TaskQueue* worker_queue_; |
| 75 const webrtc::AudioSendStream::Config config_; | 85 const webrtc::AudioSendStream::Config config_; |
| 76 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 86 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
| 77 std::unique_ptr<voe::ChannelProxy> channel_proxy_; | 87 std::unique_ptr<voe::ChannelProxy> channel_proxy_; |
| 78 | 88 |
| 79 BitrateAllocator* const bitrate_allocator_; | 89 BitrateAllocator* const bitrate_allocator_; |
| 80 SendSideCongestionController* const send_side_cc_; | 90 SendSideCongestionController* const send_side_cc_; |
| 81 std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; | 91 std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; |
| 82 | 92 |
| 93 rtc::CriticalSection packet_loss_tracker_cs_; |
| 94 TransportFeedbackPacketLossTracker packet_loss_tracker_ |
| 95 GUARDED_BY(&packet_loss_tracker_cs_); |
| 96 |
| 83 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); | 97 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); |
| 84 }; | 98 }; |
| 85 } // namespace internal | 99 } // namespace internal |
| 86 } // namespace webrtc | 100 } // namespace webrtc |
| 87 | 101 |
| 88 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ | 102 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ |
| OLD | NEW |