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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.h

Issue 2685893002: Support N unsignaled audio streams (Closed)
Patch Set: add histogram for # unsignaled audio streams Created 3 years, 9 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
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvoiceengine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 bool SetAudioSend(uint32_t ssrc, 181 bool SetAudioSend(uint32_t ssrc,
182 bool enable, 182 bool enable,
183 const AudioOptions* options, 183 const AudioOptions* options,
184 AudioSource* source) override; 184 AudioSource* source) override;
185 bool AddSendStream(const StreamParams& sp) override; 185 bool AddSendStream(const StreamParams& sp) override;
186 bool RemoveSendStream(uint32_t ssrc) override; 186 bool RemoveSendStream(uint32_t ssrc) override;
187 bool AddRecvStream(const StreamParams& sp) override; 187 bool AddRecvStream(const StreamParams& sp) override;
188 bool RemoveRecvStream(uint32_t ssrc) override; 188 bool RemoveRecvStream(uint32_t ssrc) override;
189 bool GetActiveStreams(AudioInfo::StreamList* actives) override; 189 bool GetActiveStreams(AudioInfo::StreamList* actives) override;
190 int GetOutputLevel() override; 190 int GetOutputLevel() override;
191 // SSRC=0 will apply the new volume to current and future unsignaled streams.
191 bool SetOutputVolume(uint32_t ssrc, double volume) override; 192 bool SetOutputVolume(uint32_t ssrc, double volume) override;
192 193
193 bool CanInsertDtmf() override; 194 bool CanInsertDtmf() override;
194 bool InsertDtmf(uint32_t ssrc, int event, int duration) override; 195 bool InsertDtmf(uint32_t ssrc, int event, int duration) override;
195 196
196 void OnPacketReceived(rtc::CopyOnWriteBuffer* packet, 197 void OnPacketReceived(rtc::CopyOnWriteBuffer* packet,
197 const rtc::PacketTime& packet_time) override; 198 const rtc::PacketTime& packet_time) override;
198 void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet, 199 void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet,
199 const rtc::PacketTime& packet_time) override; 200 const rtc::PacketTime& packet_time) override;
200 void OnNetworkRouteChanged(const std::string& transport_name, 201 void OnNetworkRouteChanged(const std::string& transport_name,
201 const rtc::NetworkRoute& network_route) override; 202 const rtc::NetworkRoute& network_route) override;
202 void OnReadyToSend(bool ready) override; 203 void OnReadyToSend(bool ready) override;
203 void OnTransportOverheadChanged(int transport_overhead_per_packet) override; 204 void OnTransportOverheadChanged(int transport_overhead_per_packet) override;
204 bool GetStats(VoiceMediaInfo* info) override; 205 bool GetStats(VoiceMediaInfo* info) override;
205 206
207 // SSRC=0 will set the audio sink on the latest unsignaled stream, future or
208 // current. Only one stream at a time will use the sink.
206 void SetRawAudioSink( 209 void SetRawAudioSink(
207 uint32_t ssrc, 210 uint32_t ssrc,
208 std::unique_ptr<webrtc::AudioSinkInterface> sink) override; 211 std::unique_ptr<webrtc::AudioSinkInterface> sink) override;
209 212
210 // implements Transport interface 213 // implements Transport interface
211 bool SendRtp(const uint8_t* data, 214 bool SendRtp(const uint8_t* data,
212 size_t len, 215 size_t len,
213 const webrtc::PacketOptions& options) override { 216 const webrtc::PacketOptions& options) override {
214 rtc::CopyOnWriteBuffer packet(data, len, kMaxRtpPacketLen); 217 rtc::CopyOnWriteBuffer packet(data, len, kMaxRtpPacketLen);
215 rtc::PacketOptions rtc_options; 218 rtc::PacketOptions rtc_options;
(...skipping 15 matching lines...) Expand all
231 bool SetSendCodecs(const std::vector<AudioCodec>& codecs); 234 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
232 bool SetLocalSource(uint32_t ssrc, AudioSource* source); 235 bool SetLocalSource(uint32_t ssrc, AudioSource* source);
233 bool MuteStream(uint32_t ssrc, bool mute); 236 bool MuteStream(uint32_t ssrc, bool mute);
234 237
235 WebRtcVoiceEngine* engine() { return engine_; } 238 WebRtcVoiceEngine* engine() { return engine_; }
236 int GetLastEngineError() { return engine()->GetLastEngineError(); } 239 int GetLastEngineError() { return engine()->GetLastEngineError(); }
237 int GetOutputLevel(int channel); 240 int GetOutputLevel(int channel);
238 void ChangePlayout(bool playout); 241 void ChangePlayout(bool playout);
239 int CreateVoEChannel(); 242 int CreateVoEChannel();
240 bool DeleteVoEChannel(int channel); 243 bool DeleteVoEChannel(int channel);
241 bool IsDefaultRecvStream(uint32_t ssrc) {
242 return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
243 }
244 bool SetMaxSendBitrate(int bps); 244 bool SetMaxSendBitrate(int bps);
245 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters); 245 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters);
246 void SetupRecording(); 246 void SetupRecording();
247 // Check if 'ssrc' is an unsignaled stream, and if so mark it as not being
248 // unsignaled anymore (i.e. it is now removed, or signaled), and return true.
249 bool MaybeDeregisterUnsignaledRecvStream(uint32_t ssrc);
247 250
248 rtc::ThreadChecker worker_thread_checker_; 251 rtc::ThreadChecker worker_thread_checker_;
249 252
250 WebRtcVoiceEngine* const engine_ = nullptr; 253 WebRtcVoiceEngine* const engine_ = nullptr;
251 std::vector<AudioCodec> send_codecs_; 254 std::vector<AudioCodec> send_codecs_;
252 std::vector<AudioCodec> recv_codecs_; 255 std::vector<AudioCodec> recv_codecs_;
253 int max_send_bitrate_bps_ = 0; 256 int max_send_bitrate_bps_ = 0;
254 AudioOptions options_; 257 AudioOptions options_;
255 rtc::Optional<int> dtmf_payload_type_; 258 rtc::Optional<int> dtmf_payload_type_;
256 int dtmf_payload_freq_ = -1; 259 int dtmf_payload_freq_ = -1;
257 bool recv_transport_cc_enabled_ = false; 260 bool recv_transport_cc_enabled_ = false;
258 bool recv_nack_enabled_ = false; 261 bool recv_nack_enabled_ = false;
259 bool desired_playout_ = false; 262 bool desired_playout_ = false;
260 bool playout_ = false; 263 bool playout_ = false;
261 bool send_ = false; 264 bool send_ = false;
262 webrtc::Call* const call_ = nullptr; 265 webrtc::Call* const call_ = nullptr;
263 webrtc::Call::Config::BitrateConfig bitrate_config_; 266 webrtc::Call::Config::BitrateConfig bitrate_config_;
264 267
265 // SSRC of unsignalled receive stream, or -1 if there isn't one. 268 // Queue of unsignaled SSRCs; oldest at the beginning.
266 int64_t default_recv_ssrc_ = -1; 269 std::vector<uint32_t> unsignaled_recv_ssrcs_;
267 // Volume for unsignalled stream, which may be set before the stream exists. 270
271 // Volume for unsignaled streams, which may be set before the stream exists.
268 double default_recv_volume_ = 1.0; 272 double default_recv_volume_ = 1.0;
269 // Sink for unsignalled stream, which may be set before the stream exists. 273 // Sink for latest unsignaled stream - may be set before the stream exists.
270 std::unique_ptr<webrtc::AudioSinkInterface> default_sink_; 274 std::unique_ptr<webrtc::AudioSinkInterface> default_sink_;
271 // Default SSRC to use for RTCP receiver reports in case of no signaled 275 // Default SSRC to use for RTCP receiver reports in case of no signaled
272 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 276 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740
273 // and https://code.google.com/p/chromium/issues/detail?id=547661 277 // and https://code.google.com/p/chromium/issues/detail?id=547661
274 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; 278 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u;
275 279
276 class WebRtcAudioSendStream; 280 class WebRtcAudioSendStream;
277 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; 281 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_;
278 std::vector<webrtc::RtpExtension> send_rtp_extensions_; 282 std::vector<webrtc::RtpExtension> send_rtp_extensions_;
279 283
280 class WebRtcAudioReceiveStream; 284 class WebRtcAudioReceiveStream;
281 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_; 285 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_;
282 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 286 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
283 287
284 webrtc::AudioSendStream::Config::SendCodecSpec send_codec_spec_; 288 webrtc::AudioSendStream::Config::SendCodecSpec send_codec_spec_;
285 289
286 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); 290 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
287 }; 291 };
288 } // namespace cricket 292 } // namespace cricket
289 293
290 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ 294 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698