OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 | 242 |
243 int GetReceiveChannelId(uint32_t ssrc) const; | 243 int GetReceiveChannelId(uint32_t ssrc) const; |
244 int GetSendChannelId(uint32_t ssrc) const; | 244 int GetSendChannelId(uint32_t ssrc) const; |
245 | 245 |
246 private: | 246 private: |
247 bool SetSendCodecs(const std::vector<AudioCodec>& codecs); | 247 bool SetSendCodecs(const std::vector<AudioCodec>& codecs); |
248 bool SetOptions(const AudioOptions& options); | 248 bool SetOptions(const AudioOptions& options); |
249 bool SetMaxSendBandwidth(int bps); | 249 bool SetMaxSendBandwidth(int bps); |
250 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs); | 250 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs); |
251 bool SetRecvRtpHeaderExtensions( | |
252 const std::vector<RtpHeaderExtension>& extensions); | |
253 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); | 251 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); |
254 bool MuteStream(uint32_t ssrc, bool mute); | 252 bool MuteStream(uint32_t ssrc, bool mute); |
255 | 253 |
256 WebRtcVoiceEngine* engine() { return engine_; } | 254 WebRtcVoiceEngine* engine() { return engine_; } |
257 int GetLastEngineError() { return engine()->GetLastEngineError(); } | 255 int GetLastEngineError() { return engine()->GetLastEngineError(); } |
258 int GetOutputLevel(int channel); | 256 int GetOutputLevel(int channel); |
259 bool GetRedSendCodec(const AudioCodec& red_codec, | 257 bool GetRedSendCodec(const AudioCodec& red_codec, |
260 const std::vector<AudioCodec>& all_codecs, | 258 const std::vector<AudioCodec>& all_codecs, |
261 webrtc::CodecInst* send_codec); | 259 webrtc::CodecInst* send_codec); |
262 bool SetPlayout(int channel, bool playout); | 260 bool SetPlayout(int channel, bool playout); |
263 | |
264 typedef int (webrtc::VoERTP_RTCP::* ExtensionSetterFunction)(int, bool, | |
265 unsigned char); | |
266 | |
267 void SetNack(int channel, bool nack_enabled); | 261 void SetNack(int channel, bool nack_enabled); |
268 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); | 262 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); |
269 bool ChangePlayout(bool playout); | 263 bool ChangePlayout(bool playout); |
270 bool ChangeSend(SendFlags send); | 264 bool ChangeSend(SendFlags send); |
271 bool ChangeSend(int channel, SendFlags send); | 265 bool ChangeSend(int channel, SendFlags send); |
272 bool ConfigureRecvChannel(int channel); | |
273 int CreateVoEChannel(); | 266 int CreateVoEChannel(); |
274 bool DeleteChannel(int channel); | 267 bool DeleteVoEChannel(int channel); |
275 bool IsDefaultRecvStream(uint32_t ssrc) { | 268 bool IsDefaultRecvStream(uint32_t ssrc) { |
276 return default_recv_ssrc_ == static_cast<int64_t>(ssrc); | 269 return default_recv_ssrc_ == static_cast<int64_t>(ssrc); |
277 } | 270 } |
278 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); | 271 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); |
279 bool SetSendBitrateInternal(int bps); | 272 bool SetSendBitrateInternal(int bps); |
280 | |
281 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, | |
282 const RtpHeaderExtension* extension); | |
283 void RecreateAudioReceiveStreams(); | |
284 void AddAudioReceiveStream(uint32_t ssrc); | |
285 void RemoveAudioReceiveStream(uint32_t ssrc); | |
286 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); | 273 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); |
287 | 274 |
288 bool SetChannelRecvRtpHeaderExtensions( | |
289 int channel_id, | |
290 const std::vector<RtpHeaderExtension>& extensions); | |
291 | |
292 rtc::ThreadChecker worker_thread_checker_; | 275 rtc::ThreadChecker worker_thread_checker_; |
293 | 276 |
294 WebRtcVoiceEngine* const engine_ = nullptr; | 277 WebRtcVoiceEngine* const engine_ = nullptr; |
295 std::vector<AudioCodec> recv_codecs_; | 278 std::vector<AudioCodec> recv_codecs_; |
296 std::vector<AudioCodec> send_codecs_; | 279 std::vector<AudioCodec> send_codecs_; |
297 rtc::scoped_ptr<webrtc::CodecInst> send_codec_; | 280 rtc::scoped_ptr<webrtc::CodecInst> send_codec_; |
298 bool send_bitrate_setting_ = false; | 281 bool send_bitrate_setting_ = false; |
299 int send_bitrate_bps_ = 0; | 282 int send_bitrate_bps_ = 0; |
300 AudioOptions options_; | 283 AudioOptions options_; |
301 bool dtmf_allowed_ = false; | 284 bool dtmf_allowed_ = false; |
(...skipping 11 matching lines...) Expand all Loading... |
313 // Default SSRC to use for RTCP receiver reports in case of no signaled | 296 // Default SSRC to use for RTCP receiver reports in case of no signaled |
314 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 | 297 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 |
315 // and https://code.google.com/p/chromium/issues/detail?id=547661 | 298 // and https://code.google.com/p/chromium/issues/detail?id=547661 |
316 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; | 299 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; |
317 | 300 |
318 class WebRtcAudioSendStream; | 301 class WebRtcAudioSendStream; |
319 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; | 302 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; |
320 std::vector<webrtc::RtpExtension> send_rtp_extensions_; | 303 std::vector<webrtc::RtpExtension> send_rtp_extensions_; |
321 | 304 |
322 class WebRtcAudioReceiveStream; | 305 class WebRtcAudioReceiveStream; |
323 std::map<uint32_t, WebRtcAudioReceiveStream*> receive_channels_; | 306 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_; |
324 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_; | |
325 std::map<uint32_t, StreamParams> receive_stream_params_; | |
326 // receive_channels_ can be read from WebRtc callback thread. Access from | |
327 // the WebRtc thread must be synchronized with edits on the worker thread. | |
328 // Reads on the worker thread are ok. | |
329 std::vector<RtpHeaderExtension> receive_extensions_; | |
330 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 307 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
331 | 308 |
332 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); | 309 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); |
333 }; | 310 }; |
334 } // namespace cricket | 311 } // namespace cricket |
335 | 312 |
336 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 313 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |