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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, | 238 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, |
239 kMaxRtpPacketLen); | 239 kMaxRtpPacketLen); |
240 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions()); | 240 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions()); |
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 SetSendRtpHeaderExtensions( | |
249 const std::vector<RtpHeaderExtension>& extensions); | |
250 bool SetOptions(const AudioOptions& options); | 248 bool SetOptions(const AudioOptions& options); |
251 bool SetMaxSendBandwidth(int bps); | 249 bool SetMaxSendBandwidth(int bps); |
252 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs); | 250 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs); |
253 bool SetRecvRtpHeaderExtensions( | 251 bool SetRecvRtpHeaderExtensions( |
254 const std::vector<RtpHeaderExtension>& extensions); | 252 const std::vector<RtpHeaderExtension>& extensions); |
255 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); | 253 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); |
256 bool MuteStream(uint32_t ssrc, bool mute); | 254 bool MuteStream(uint32_t ssrc, bool mute); |
257 | 255 |
258 WebRtcVoiceEngine* engine() { return engine_; } | 256 WebRtcVoiceEngine* engine() { return engine_; } |
259 int GetLastEngineError() { return engine()->GetLastEngineError(); } | 257 int GetLastEngineError() { return engine()->GetLastEngineError(); } |
(...skipping 23 matching lines...) Expand all Loading... |
283 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, | 281 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id, |
284 const RtpHeaderExtension* extension); | 282 const RtpHeaderExtension* extension); |
285 void RecreateAudioReceiveStreams(); | 283 void RecreateAudioReceiveStreams(); |
286 void AddAudioReceiveStream(uint32_t ssrc); | 284 void AddAudioReceiveStream(uint32_t ssrc); |
287 void RemoveAudioReceiveStream(uint32_t ssrc); | 285 void RemoveAudioReceiveStream(uint32_t ssrc); |
288 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); | 286 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs); |
289 | 287 |
290 bool SetChannelRecvRtpHeaderExtensions( | 288 bool SetChannelRecvRtpHeaderExtensions( |
291 int channel_id, | 289 int channel_id, |
292 const std::vector<RtpHeaderExtension>& extensions); | 290 const std::vector<RtpHeaderExtension>& extensions); |
293 bool SetChannelSendRtpHeaderExtensions( | |
294 int channel_id, | |
295 const std::vector<RtpHeaderExtension>& extensions); | |
296 | 291 |
297 rtc::ThreadChecker worker_thread_checker_; | 292 rtc::ThreadChecker worker_thread_checker_; |
298 | 293 |
299 WebRtcVoiceEngine* const engine_ = nullptr; | 294 WebRtcVoiceEngine* const engine_ = nullptr; |
300 std::vector<AudioCodec> recv_codecs_; | 295 std::vector<AudioCodec> recv_codecs_; |
301 std::vector<AudioCodec> send_codecs_; | 296 std::vector<AudioCodec> send_codecs_; |
302 rtc::scoped_ptr<webrtc::CodecInst> send_codec_; | 297 rtc::scoped_ptr<webrtc::CodecInst> send_codec_; |
303 bool send_bitrate_setting_ = false; | 298 bool send_bitrate_setting_ = false; |
304 int send_bitrate_bps_ = 0; | 299 int send_bitrate_bps_ = 0; |
305 AudioOptions options_; | 300 AudioOptions options_; |
306 bool dtmf_allowed_ = false; | 301 bool dtmf_allowed_ = false; |
307 bool desired_playout_ = false; | 302 bool desired_playout_ = false; |
308 bool nack_enabled_ = false; | 303 bool nack_enabled_ = false; |
309 bool playout_ = false; | 304 bool playout_ = false; |
310 SendFlags desired_send_ = SEND_NOTHING; | 305 SendFlags desired_send_ = SEND_NOTHING; |
311 SendFlags send_ = SEND_NOTHING; | 306 SendFlags send_ = SEND_NOTHING; |
312 webrtc::Call* const call_ = nullptr; | 307 webrtc::Call* const call_ = nullptr; |
313 | 308 |
314 // SSRC of unsignalled receive stream, or -1 if there isn't one. | 309 // SSRC of unsignalled receive stream, or -1 if there isn't one. |
315 int64_t default_recv_ssrc_ = -1; | 310 int64_t default_recv_ssrc_ = -1; |
316 // Volume for unsignalled stream, which may be set before the stream exists. | 311 // Volume for unsignalled stream, which may be set before the stream exists. |
317 double default_recv_volume_ = 1.0; | 312 double default_recv_volume_ = 1.0; |
318 // Default SSRC to use for RTCP receiver reports in case of no signaled | 313 // Default SSRC to use for RTCP receiver reports in case of no signaled |
319 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 | 314 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 |
320 // and https://code.google.com/p/chromium/issues/detail?id=547661 | 315 // and https://code.google.com/p/chromium/issues/detail?id=547661 |
321 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; | 316 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; |
322 | 317 |
323 class WebRtcAudioSendStream; | 318 class WebRtcAudioSendStream; |
324 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; | 319 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; |
325 std::vector<RtpHeaderExtension> send_extensions_; | 320 std::vector<webrtc::RtpExtension> send_rtp_extensions_; |
326 | 321 |
327 class WebRtcAudioReceiveStream; | 322 class WebRtcAudioReceiveStream; |
328 std::map<uint32_t, WebRtcAudioReceiveStream*> receive_channels_; | 323 std::map<uint32_t, WebRtcAudioReceiveStream*> receive_channels_; |
329 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_; | 324 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_; |
330 std::map<uint32_t, StreamParams> receive_stream_params_; | 325 std::map<uint32_t, StreamParams> receive_stream_params_; |
331 // receive_channels_ can be read from WebRtc callback thread. Access from | 326 // receive_channels_ can be read from WebRtc callback thread. Access from |
332 // the WebRtc thread must be synchronized with edits on the worker thread. | 327 // the WebRtc thread must be synchronized with edits on the worker thread. |
333 // Reads on the worker thread are ok. | 328 // Reads on the worker thread are ok. |
334 std::vector<RtpHeaderExtension> receive_extensions_; | 329 std::vector<RtpHeaderExtension> receive_extensions_; |
335 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 330 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
336 | 331 |
337 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); | 332 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); |
338 }; | 333 }; |
339 } // namespace cricket | 334 } // namespace cricket |
340 | 335 |
341 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 336 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |