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

Side by Side Diff: webrtc/voice_engine/channel_proxy.h

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

Powered by Google App Engine
This is Rietveld 408576698