| 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 #include <vector> |
| 16 | 16 |
| 17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
| 18 #include "webrtc/base/thread_checker.h" | 18 #include "webrtc/base/thread_checker.h" |
| 19 #include "webrtc/call/audio_send_stream.h" | 19 #include "webrtc/call/audio_send_stream.h" |
| 20 #include "webrtc/call/audio_state.h" | 20 #include "webrtc/call/audio_state.h" |
| 21 #include "webrtc/call/bitrate_allocator.h" | 21 #include "webrtc/call/bitrate_allocator.h" |
| 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
| 23 #include "webrtc/voice_engine/transport_feedback_packet_loss_tracker.h" | 23 #include "webrtc/voice_engine/transport_feedback_packet_loss_tracker.h" |
| 24 | 24 |
| 25 namespace webrtc { | 25 namespace webrtc { |
| 26 class VoiceEngine; | 26 class VoiceEngine; |
| 27 class RtcEventLog; | 27 class RtcEventLog; |
| 28 class RtcpBandwidthObserver; | 28 class RtcpBandwidthObserver; |
| 29 class RtcpRttStats; | 29 class RtcpRttStats; |
| 30 class RtpTransportControllerSendInterface; | 30 class RtpTransportControllerSendInterface; |
| 31 | 31 |
| 32 namespace voe { | 32 namespace voe { |
| 33 class ChannelProxy; | 33 class ChannelProxy; |
| 34 } // namespace voe | 34 } // namespace voe |
| 35 | 35 |
| 36 namespace internal { | 36 namespace internal { |
| 37 class AudioSendStream final : public webrtc::AudioSendStream, | 37 class AudioSendStream final : public webrtc::AudioSendStream, |
| 38 public webrtc::BitrateAllocatorObserver, | 38 public webrtc::BitrateAllocatorObserver, |
| 39 public webrtc::PacketFeedbackObserver { | 39 public webrtc::PacketFeedbackObserver { |
| 40 public: | 40 public: |
| 41 AudioSendStream(const webrtc::AudioSendStream::Config& config, | 41 AudioSendStream(const webrtc::AudioSendStream::Config& config, |
| 42 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 42 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
| 43 rtc::TaskQueue* worker_queue, | 43 rtc::TaskQueue* worker_queue, |
| 44 RtpTransportControllerSendInterface* transport, | 44 RtpTransportControllerSendInterface* transport, |
| 45 BitrateAllocator* bitrate_allocator, | 45 BitrateAllocator* bitrate_allocator, |
| 46 RtcEventLog* event_log, | 46 RtcEventLog* event_log, |
| 47 RtcpRttStats* rtcp_rtt_stats); | 47 RtcpRttStats* rtcp_rtt_stats, |
| 48 const rtc::Optional<RtpState>& suspended_rtp_state); |
| 48 ~AudioSendStream() override; | 49 ~AudioSendStream() override; |
| 49 | 50 |
| 50 // webrtc::AudioSendStream implementation. | 51 // webrtc::AudioSendStream implementation. |
| 51 void Reconfigure(const webrtc::AudioSendStream::Config& config) override; | 52 void Reconfigure(const webrtc::AudioSendStream::Config& config) override; |
| 52 | 53 |
| 53 void Start() override; | 54 void Start() override; |
| 54 void Stop() override; | 55 void Stop() override; |
| 55 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, | 56 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, |
| 56 int duration_ms) override; | 57 int duration_ms) override; |
| 57 void SetMuted(bool muted) override; | 58 void SetMuted(bool muted) override; |
| 58 webrtc::AudioSendStream::Stats GetStats() const override; | 59 webrtc::AudioSendStream::Stats GetStats() const override; |
| 59 | 60 |
| 60 void SignalNetworkState(NetworkState state); | 61 void SignalNetworkState(NetworkState state); |
| 61 bool DeliverRtcp(const uint8_t* packet, size_t length); | 62 bool DeliverRtcp(const uint8_t* packet, size_t length); |
| 62 | 63 |
| 63 // Implements BitrateAllocatorObserver. | 64 // Implements BitrateAllocatorObserver. |
| 64 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, | 65 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, |
| 65 uint8_t fraction_loss, | 66 uint8_t fraction_loss, |
| 66 int64_t rtt, | 67 int64_t rtt, |
| 67 int64_t bwe_period_ms) override; | 68 int64_t bwe_period_ms) override; |
| 68 | 69 |
| 69 // From PacketFeedbackObserver. | 70 // From PacketFeedbackObserver. |
| 70 void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override; | 71 void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override; |
| 71 void OnPacketFeedbackVector( | 72 void OnPacketFeedbackVector( |
| 72 const std::vector<PacketFeedback>& packet_feedback_vector) override; | 73 const std::vector<PacketFeedback>& packet_feedback_vector) override; |
| 73 | 74 |
| 74 const webrtc::AudioSendStream::Config& config() const; | 75 const webrtc::AudioSendStream::Config& config() const; |
| 75 void SetTransportOverhead(int transport_overhead_per_packet); | 76 void SetTransportOverhead(int transport_overhead_per_packet); |
| 76 | 77 |
| 78 RtpState GetRtpState() const; |
| 79 |
| 77 private: | 80 private: |
| 78 VoiceEngine* voice_engine() const; | 81 VoiceEngine* voice_engine() const; |
| 79 | 82 |
| 80 // These are all static to make it less likely that (the old) config_ is | 83 // These are all static to make it less likely that (the old) config_ is |
| 81 // accessed unintentionally. | 84 // accessed unintentionally. |
| 82 static void ConfigureStream(AudioSendStream* stream, | 85 static void ConfigureStream(AudioSendStream* stream, |
| 83 const Config& new_config, | 86 const Config& new_config, |
| 84 bool first_time); | 87 bool first_time); |
| 85 static bool SetupSendCodec(AudioSendStream* stream, const Config& new_config); | 88 static bool SetupSendCodec(AudioSendStream* stream, const Config& new_config); |
| 86 static bool ReconfigureSendCodec(AudioSendStream* stream, | 89 static bool ReconfigureSendCodec(AudioSendStream* stream, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 104 RtcEventLog* const event_log_; | 107 RtcEventLog* const event_log_; |
| 105 | 108 |
| 106 BitrateAllocator* const bitrate_allocator_; | 109 BitrateAllocator* const bitrate_allocator_; |
| 107 RtpTransportControllerSendInterface* const transport_; | 110 RtpTransportControllerSendInterface* const transport_; |
| 108 std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; | 111 std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; |
| 109 | 112 |
| 110 rtc::CriticalSection packet_loss_tracker_cs_; | 113 rtc::CriticalSection packet_loss_tracker_cs_; |
| 111 TransportFeedbackPacketLossTracker packet_loss_tracker_ | 114 TransportFeedbackPacketLossTracker packet_loss_tracker_ |
| 112 GUARDED_BY(&packet_loss_tracker_cs_); | 115 GUARDED_BY(&packet_loss_tracker_cs_); |
| 113 | 116 |
| 117 RtpRtcp* rtp_rtcp_module_; |
| 118 rtc::Optional<RtpState> const suspended_rtp_state_; |
| 119 |
| 114 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); | 120 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); |
| 115 }; | 121 }; |
| 116 } // namespace internal | 122 } // namespace internal |
| 117 } // namespace webrtc | 123 } // namespace webrtc |
| 118 | 124 |
| 119 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ | 125 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ |
| OLD | NEW |