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/api/call/audio_send_stream.h" | 16 #include "webrtc/api/call/audio_send_stream.h" |
17 #include "webrtc/api/call/audio_state.h" | 17 #include "webrtc/api/call/audio_state.h" |
18 #include "webrtc/base/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
| 19 #include "webrtc/base/onetimeevent.h" |
19 #include "webrtc/base/thread_checker.h" | 20 #include "webrtc/base/thread_checker.h" |
| 21 #include "webrtc/base/weak_ptr.h" |
20 #include "webrtc/call/bitrate_allocator.h" | 22 #include "webrtc/call/bitrate_allocator.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 | 28 |
27 namespace voe { | 29 namespace voe { |
28 class ChannelProxy; | 30 class ChannelProxy; |
29 } // namespace voe | 31 } // namespace voe |
(...skipping 23 matching lines...) Expand all Loading... |
53 | 55 |
54 // Implements BitrateAllocatorObserver. | 56 // Implements BitrateAllocatorObserver. |
55 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, | 57 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, |
56 uint8_t fraction_loss, | 58 uint8_t fraction_loss, |
57 int64_t rtt) override; | 59 int64_t rtt) override; |
58 | 60 |
59 const webrtc::AudioSendStream::Config& config() const; | 61 const webrtc::AudioSendStream::Config& config() const; |
60 void SetTransportOverhead(int transport_overhead_per_packet); | 62 void SetTransportOverhead(int transport_overhead_per_packet); |
61 | 63 |
62 private: | 64 private: |
| 65 class AdaptCodecTask; |
| 66 |
63 VoiceEngine* voice_engine() const; | 67 VoiceEngine* voice_engine() const; |
64 | 68 |
65 bool SetupSendCodec(); | 69 bool SetupSendCodec(); |
| 70 void AdaptCodec(); |
66 | 71 |
67 rtc::ThreadChecker thread_checker_; | 72 rtc::ThreadChecker thread_checker_; |
68 rtc::TaskQueue* worker_queue_; | 73 rtc::TaskQueue* worker_queue_; |
69 const webrtc::AudioSendStream::Config config_; | 74 const webrtc::AudioSendStream::Config config_; |
70 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 75 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
71 std::unique_ptr<voe::ChannelProxy> channel_proxy_; | 76 std::unique_ptr<voe::ChannelProxy> channel_proxy_; |
72 | 77 |
73 BitrateAllocator* const bitrate_allocator_; | 78 BitrateAllocator* const bitrate_allocator_; |
| 79 OneTimeEvent first_update_bitrate_; |
| 80 |
| 81 // |weak_ptr_| to our self. This is used since we can not call |
| 82 // |weak_ptr_factory_.GetWeakPtr| from multiple sequences but it is ok to copy |
| 83 // an existing WeakPtr. |
| 84 rtc::WeakPtr<AudioSendStream> weak_ptr_; |
| 85 // |weak_ptr_factory_| must be declared last to make sure all WeakPtr's are |
| 86 // invalidated before any other members are destroyed. |
| 87 std::unique_ptr<rtc::WeakPtrFactory<AudioSendStream>> weak_ptr_factory_; |
74 | 88 |
75 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); | 89 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); |
76 }; | 90 }; |
77 } // namespace internal | 91 } // namespace internal |
78 } // namespace webrtc | 92 } // namespace webrtc |
79 | 93 |
80 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ | 94 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ |
OLD | NEW |