Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1110)

Side by Side Diff: webrtc/audio/audio_send_stream.h

Issue 2705093002: Injectable audio encoders: WebRtcVoiceEngine and company (Closed)
Patch Set: Moved duplicated configuration from constructor to ConfigureStream (previously Reconfigure) Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 30 matching lines...) Expand all
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 ~AudioSendStream() override; 48 ~AudioSendStream() override;
49 49
50 // webrtc::AudioSendStream implementation. 50 // webrtc::AudioSendStream implementation.
51 void Reconfigure(const webrtc::AudioSendStream::Config& config) override;
52
51 void Start() override; 53 void Start() override;
52 void Stop() override; 54 void Stop() override;
53 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event, 55 bool SendTelephoneEvent(int payload_type, int payload_frequency, int event,
54 int duration_ms) override; 56 int duration_ms) override;
55 void SetMuted(bool muted) override; 57 void SetMuted(bool muted) override;
56 webrtc::AudioSendStream::Stats GetStats() const override; 58 webrtc::AudioSendStream::Stats GetStats() const override;
57 59
58 void SignalNetworkState(NetworkState state); 60 void SignalNetworkState(NetworkState state);
59 bool DeliverRtcp(const uint8_t* packet, size_t length); 61 bool DeliverRtcp(const uint8_t* packet, size_t length);
60 62
61 // Implements BitrateAllocatorObserver. 63 // Implements BitrateAllocatorObserver.
62 uint32_t OnBitrateUpdated(uint32_t bitrate_bps, 64 uint32_t OnBitrateUpdated(uint32_t bitrate_bps,
63 uint8_t fraction_loss, 65 uint8_t fraction_loss,
64 int64_t rtt, 66 int64_t rtt,
65 int64_t probing_interval_ms) override; 67 int64_t probing_interval_ms) override;
66 68
67 // From PacketFeedbackObserver. 69 // From PacketFeedbackObserver.
68 void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override; 70 void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override;
69 void OnPacketFeedbackVector( 71 void OnPacketFeedbackVector(
70 const std::vector<PacketFeedback>& packet_feedback_vector) override; 72 const std::vector<PacketFeedback>& packet_feedback_vector) override;
71 73
72 const webrtc::AudioSendStream::Config& config() const; 74 const webrtc::AudioSendStream::Config& config() const;
73 void SetTransportOverhead(int transport_overhead_per_packet); 75 void SetTransportOverhead(int transport_overhead_per_packet);
74 76
75 private: 77 private:
76 VoiceEngine* voice_engine() const; 78 VoiceEngine* voice_engine() const;
77 79
78 bool SetupSendCodec(); 80 // These are all static to make it less likely that (the old) config_ is
81 // accessed unintentionally.
82 static void ConfigureStream(AudioSendStream* stream,
83 const Config& new_config);
84 static bool SetupSendCodec(AudioSendStream* stream, const Config& new_config);
85 static bool ReconfigureSendCodec(AudioSendStream* stream,
86 const Config& new_config);
87 static void ReconfigureANA(AudioSendStream* stream, const Config& new_config);
88 static void ReconfigureCNG(AudioSendStream* stream, const Config& new_config);
89 static void ReconfigureBitrateObserver(AudioSendStream* stream,
90 const Config& new_config);
91
92 void ConfigureBitrateObserver(int min_bitrate_bps, int max_bitrate_bps);
93 void RemoveBitrateObserver();
79 94
80 rtc::ThreadChecker worker_thread_checker_; 95 rtc::ThreadChecker worker_thread_checker_;
81 rtc::ThreadChecker pacer_thread_checker_; 96 rtc::ThreadChecker pacer_thread_checker_;
82 rtc::TaskQueue* worker_queue_; 97 rtc::TaskQueue* worker_queue_;
83 const webrtc::AudioSendStream::Config config_; 98 webrtc::AudioSendStream::Config config_;
84 rtc::scoped_refptr<webrtc::AudioState> audio_state_; 99 rtc::scoped_refptr<webrtc::AudioState> audio_state_;
85 std::unique_ptr<voe::ChannelProxy> channel_proxy_; 100 std::unique_ptr<voe::ChannelProxy> channel_proxy_;
101 RtcEventLog* const event_log_;
86 102
87 BitrateAllocator* const bitrate_allocator_; 103 BitrateAllocator* const bitrate_allocator_;
88 RtpTransportControllerSendInterface* const transport_; 104 RtpTransportControllerSendInterface* const transport_;
89 std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_; 105 std::unique_ptr<RtcpBandwidthObserver> bandwidth_observer_;
90 106
91 rtc::CriticalSection packet_loss_tracker_cs_; 107 rtc::CriticalSection packet_loss_tracker_cs_;
92 TransportFeedbackPacketLossTracker packet_loss_tracker_ 108 TransportFeedbackPacketLossTracker packet_loss_tracker_
93 GUARDED_BY(&packet_loss_tracker_cs_); 109 GUARDED_BY(&packet_loss_tracker_cs_);
94 110
111 bool is_configured_ = false;
112
95 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream); 113 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream);
96 }; 114 };
97 } // namespace internal 115 } // namespace internal
98 } // namespace webrtc 116 } // namespace webrtc
99 117
100 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_ 118 #endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698