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

Side by Side Diff: webrtc/voice_engine/channel_proxy.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // 2. Provide a refined interface for the stream classes, including assumptions 50 // 2. Provide a refined interface for the stream classes, including assumptions
51 // on return values and input adaptation. 51 // on return values and input adaptation.
52 class ChannelProxy { 52 class ChannelProxy {
53 public: 53 public:
54 ChannelProxy(); 54 ChannelProxy();
55 explicit ChannelProxy(const ChannelOwner& channel_owner); 55 explicit ChannelProxy(const ChannelOwner& channel_owner);
56 virtual ~ChannelProxy(); 56 virtual ~ChannelProxy();
57 57
58 virtual bool SetEncoder(int payload_type, 58 virtual bool SetEncoder(int payload_type,
59 std::unique_ptr<AudioEncoder> encoder); 59 std::unique_ptr<AudioEncoder> encoder);
60 virtual void ModifyEncoder(
61 rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier);
60 62
61 virtual void SetRTCPStatus(bool enable); 63 virtual void SetRTCPStatus(bool enable);
62 virtual void SetLocalSSRC(uint32_t ssrc); 64 virtual void SetLocalSSRC(uint32_t ssrc);
63 virtual void SetRTCP_CNAME(const std::string& c_name); 65 virtual void SetRTCP_CNAME(const std::string& c_name);
64 virtual void SetNACKStatus(bool enable, int max_packets); 66 virtual void SetNACKStatus(bool enable, int max_packets);
65 virtual void SetSendAudioLevelIndicationStatus(bool enable, int id); 67 virtual void SetSendAudioLevelIndicationStatus(bool enable, int id);
66 virtual void SetReceiveAudioLevelIndicationStatus(bool enable, int id); 68 virtual void SetReceiveAudioLevelIndicationStatus(bool enable, int id);
67 virtual void EnableSendTransportSequenceNumber(int id); 69 virtual void EnableSendTransportSequenceNumber(int id);
68 virtual void EnableReceiveTransportSequenceNumber(int id); 70 virtual void EnableReceiveTransportSequenceNumber(int id);
69 virtual void RegisterSenderCongestionControlObjects( 71 virtual void RegisterSenderCongestionControlObjects(
(...skipping 20 matching lines...) Expand all
90 virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink); 92 virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink);
91 virtual void SetInputMute(bool muted); 93 virtual void SetInputMute(bool muted);
92 virtual void RegisterExternalTransport(Transport* transport); 94 virtual void RegisterExternalTransport(Transport* transport);
93 virtual void DeRegisterExternalTransport(); 95 virtual void DeRegisterExternalTransport();
94 virtual void OnRtpPacket(const RtpPacketReceived& packet); 96 virtual void OnRtpPacket(const RtpPacketReceived& packet);
95 virtual bool ReceivedRTCPPacket(const uint8_t* packet, size_t length); 97 virtual bool ReceivedRTCPPacket(const uint8_t* packet, size_t length);
96 virtual const rtc::scoped_refptr<AudioDecoderFactory>& 98 virtual const rtc::scoped_refptr<AudioDecoderFactory>&
97 GetAudioDecoderFactory() const; 99 GetAudioDecoderFactory() const;
98 virtual void SetChannelOutputVolumeScaling(float scaling); 100 virtual void SetChannelOutputVolumeScaling(float scaling);
99 virtual void SetRtcEventLog(RtcEventLog* event_log); 101 virtual void SetRtcEventLog(RtcEventLog* event_log);
100 virtual void EnableAudioNetworkAdaptor(const std::string& config_string);
101 virtual void DisableAudioNetworkAdaptor();
102 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms,
103 int max_frame_length_ms);
104 virtual AudioMixer::Source::AudioFrameInfo GetAudioFrameWithInfo( 102 virtual AudioMixer::Source::AudioFrameInfo GetAudioFrameWithInfo(
105 int sample_rate_hz, 103 int sample_rate_hz,
106 AudioFrame* audio_frame); 104 AudioFrame* audio_frame);
107 virtual int NeededFrequency() const; 105 virtual int NeededFrequency() const;
108 virtual void SetTransportOverhead(int transport_overhead_per_packet); 106 virtual void SetTransportOverhead(int transport_overhead_per_packet);
109 virtual void AssociateSendChannel(const ChannelProxy& send_channel_proxy); 107 virtual void AssociateSendChannel(const ChannelProxy& send_channel_proxy);
110 virtual void DisassociateSendChannel(); 108 virtual void DisassociateSendChannel();
111 virtual void GetRtpRtcp(RtpRtcp** rtp_rtcp, 109 virtual void GetRtpRtcp(RtpRtcp** rtp_rtcp,
112 RtpReceiver** rtp_receiver) const; 110 RtpReceiver** rtp_receiver) const;
113 virtual uint32_t GetPlayoutTimestamp() const; 111 virtual uint32_t GetPlayoutTimestamp() const;
114 virtual void SetMinimumPlayoutDelay(int delay_ms); 112 virtual void SetMinimumPlayoutDelay(int delay_ms);
115 virtual void SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats); 113 virtual void SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats);
116 virtual bool GetRecCodec(CodecInst* codec_inst) const; 114 virtual bool GetRecCodec(CodecInst* codec_inst) const;
117 virtual bool GetSendCodec(CodecInst* codec_inst) const;
118 virtual bool SetVADStatus(bool enable);
119 virtual bool SetCodecFECStatus(bool enable);
120 virtual bool SetOpusDtx(bool enable);
121 virtual bool SetOpusMaxPlaybackRate(int frequency_hz);
122 virtual bool SetSendCodec(const CodecInst& codec_inst);
123 virtual bool SetSendCNPayloadType(int type, PayloadFrequencies frequency);
124 virtual void OnTwccBasedUplinkPacketLossRate(float packet_loss_rate); 115 virtual void OnTwccBasedUplinkPacketLossRate(float packet_loss_rate);
125 virtual void OnRecoverableUplinkPacketLossRate( 116 virtual void OnRecoverableUplinkPacketLossRate(
126 float recoverable_packet_loss_rate); 117 float recoverable_packet_loss_rate);
127 virtual void RegisterLegacyReceiveCodecs(); 118 virtual void RegisterLegacyReceiveCodecs();
128 119
129 private: 120 private:
130 Channel* channel() const; 121 Channel* channel() const;
131 122
132 // Thread checkers document and lock usage of some methods on voe::Channel to 123 // Thread checkers document and lock usage of some methods on voe::Channel to
133 // specific threads we know about. The goal is to eventually split up 124 // specific threads we know about. The goal is to eventually split up
134 // voe::Channel into parts with single-threaded semantics, and thereby reduce 125 // voe::Channel into parts with single-threaded semantics, and thereby reduce
135 // the need for locks. 126 // the need for locks.
136 rtc::ThreadChecker worker_thread_checker_; 127 rtc::ThreadChecker worker_thread_checker_;
137 rtc::ThreadChecker module_process_thread_checker_; 128 rtc::ThreadChecker module_process_thread_checker_;
138 // Methods accessed from audio and video threads are checked for sequential- 129 // Methods accessed from audio and video threads are checked for sequential-
139 // only access. We don't necessarily own and control these threads, so thread 130 // only access. We don't necessarily own and control these threads, so thread
140 // checkers cannot be used. E.g. Chromium may transfer "ownership" from one 131 // checkers cannot be used. E.g. Chromium may transfer "ownership" from one
141 // audio thread to another, but access is still sequential. 132 // audio thread to another, but access is still sequential.
142 rtc::RaceChecker audio_thread_race_checker_; 133 rtc::RaceChecker audio_thread_race_checker_;
143 rtc::RaceChecker video_capture_thread_race_checker_; 134 rtc::RaceChecker video_capture_thread_race_checker_;
144 ChannelOwner channel_owner_; 135 ChannelOwner channel_owner_;
145 136
146 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelProxy); 137 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelProxy);
147 }; 138 };
148 } // namespace voe 139 } // namespace voe
149 } // namespace webrtc 140 } // namespace webrtc
150 141
151 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_ 142 #endif // WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698