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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 public webrtc::Transport { | 281 public webrtc::Transport { |
282 public: | 282 public: |
283 explicit WebRtcVoiceMediaChannel(WebRtcVoiceEngine *engine); | 283 explicit WebRtcVoiceMediaChannel(WebRtcVoiceEngine *engine); |
284 ~WebRtcVoiceMediaChannel() override; | 284 ~WebRtcVoiceMediaChannel() override; |
285 | 285 |
286 int voe_channel() const { return voe_channel_; } | 286 int voe_channel() const { return voe_channel_; } |
287 bool valid() const { return voe_channel_ != -1; } | 287 bool valid() const { return voe_channel_ != -1; } |
288 | 288 |
289 bool SetSendParameters(const AudioSendParameters& params) override; | 289 bool SetSendParameters(const AudioSendParameters& params) override; |
290 bool SetRecvParameters(const AudioRecvParameters& params) override; | 290 bool SetRecvParameters(const AudioRecvParameters& params) override; |
291 bool SetOptions(const AudioOptions& options) override; | |
292 bool GetOptions(AudioOptions* options) const override { | 291 bool GetOptions(AudioOptions* options) const override { |
293 *options = options_; | 292 *options = options_; |
294 return true; | 293 return true; |
295 } | 294 } |
296 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs) override; | |
297 bool SetSendCodecs(const std::vector<AudioCodec>& codecs) override; | |
298 bool SetRecvRtpHeaderExtensions( | |
299 const std::vector<RtpHeaderExtension>& extensions) override; | |
300 bool SetSendRtpHeaderExtensions( | |
301 const std::vector<RtpHeaderExtension>& extensions) override; | |
302 bool SetPlayout(bool playout) override; | 295 bool SetPlayout(bool playout) override; |
303 bool PausePlayout(); | 296 bool PausePlayout(); |
304 bool ResumePlayout(); | 297 bool ResumePlayout(); |
305 bool SetSend(SendFlags send) override; | 298 bool SetSend(SendFlags send) override; |
306 bool PauseSend(); | 299 bool PauseSend(); |
307 bool ResumeSend(); | 300 bool ResumeSend(); |
308 bool AddSendStream(const StreamParams& sp) override; | 301 bool AddSendStream(const StreamParams& sp) override; |
309 bool RemoveSendStream(uint32 ssrc) override; | 302 bool RemoveSendStream(uint32 ssrc) override; |
310 bool AddRecvStream(const StreamParams& sp) override; | 303 bool AddRecvStream(const StreamParams& sp) override; |
311 bool RemoveRecvStream(uint32 ssrc) override; | 304 bool RemoveRecvStream(uint32 ssrc) override; |
(...skipping 13 matching lines...) Expand all Loading... |
325 bool SetRingbackTone(const char* buf, int len) override; | 318 bool SetRingbackTone(const char* buf, int len) override; |
326 bool PlayRingbackTone(uint32 ssrc, bool play, bool loop) override; | 319 bool PlayRingbackTone(uint32 ssrc, bool play, bool loop) override; |
327 bool CanInsertDtmf() override; | 320 bool CanInsertDtmf() override; |
328 bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) override; | 321 bool InsertDtmf(uint32 ssrc, int event, int duration, int flags) override; |
329 | 322 |
330 void OnPacketReceived(rtc::Buffer* packet, | 323 void OnPacketReceived(rtc::Buffer* packet, |
331 const rtc::PacketTime& packet_time) override; | 324 const rtc::PacketTime& packet_time) override; |
332 void OnRtcpReceived(rtc::Buffer* packet, | 325 void OnRtcpReceived(rtc::Buffer* packet, |
333 const rtc::PacketTime& packet_time) override; | 326 const rtc::PacketTime& packet_time) override; |
334 void OnReadyToSend(bool ready) override {} | 327 void OnReadyToSend(bool ready) override {} |
335 bool MuteStream(uint32 ssrc, bool on) override; | 328 bool MuteStream(uint32 ssrc, bool mute, const AudioOptions* options) override; |
336 bool SetMaxSendBandwidth(int bps) override; | |
337 bool GetStats(VoiceMediaInfo* info) override; | 329 bool GetStats(VoiceMediaInfo* info) override; |
338 // Gets last reported error from WebRtc voice engine. This should be only | 330 // Gets last reported error from WebRtc voice engine. This should be only |
339 // called in response a failure. | 331 // called in response a failure. |
340 void GetLastMediaError(uint32* ssrc, | 332 void GetLastMediaError(uint32* ssrc, |
341 VoiceMediaChannel::Error* error) override; | 333 VoiceMediaChannel::Error* error) override; |
342 | 334 |
343 // implements Transport interface | 335 // implements Transport interface |
344 int SendPacket(int channel, const void* data, size_t len) override { | 336 int SendPacket(int channel, const void* data, size_t len) override { |
345 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, | 337 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, |
346 kMaxRtpPacketLen); | 338 kMaxRtpPacketLen); |
347 return VoiceMediaChannel::SendPacket(&packet) ? static_cast<int>(len) : -1; | 339 return VoiceMediaChannel::SendPacket(&packet) ? static_cast<int>(len) : -1; |
348 } | 340 } |
349 | 341 |
350 int SendRTCPPacket(int channel, const void* data, size_t len) override { | 342 int SendRTCPPacket(int channel, const void* data, size_t len) override { |
351 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, | 343 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, |
352 kMaxRtpPacketLen); | 344 kMaxRtpPacketLen); |
353 return VoiceMediaChannel::SendRtcp(&packet) ? static_cast<int>(len) : -1; | 345 return VoiceMediaChannel::SendRtcp(&packet) ? static_cast<int>(len) : -1; |
354 } | 346 } |
355 | 347 |
356 bool FindSsrc(int channel_num, uint32* ssrc); | 348 bool FindSsrc(int channel_num, uint32* ssrc); |
357 void OnError(uint32 ssrc, int error); | 349 void OnError(uint32 ssrc, int error); |
358 | 350 |
359 bool sending() const { return send_ != SEND_NOTHING; } | 351 bool sending() const { return send_ != SEND_NOTHING; } |
360 int GetReceiveChannelNum(uint32 ssrc) const; | 352 int GetReceiveChannelNum(uint32 ssrc) const; |
361 int GetSendChannelNum(uint32 ssrc) const; | 353 int GetSendChannelNum(uint32 ssrc) const; |
362 | 354 |
363 void SetCall(webrtc::Call* call); | 355 void SetCall(webrtc::Call* call); |
364 | 356 |
365 private: | 357 private: |
| 358 bool SetSendCodecs(const std::vector<AudioCodec>& codecs); |
| 359 bool SetSendRtpHeaderExtensions( |
| 360 const std::vector<RtpHeaderExtension>& extensions); |
| 361 bool SetOptions(const AudioOptions& options); |
| 362 bool SetMaxSendBandwidth(int bps); |
| 363 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs); |
| 364 bool SetRecvRtpHeaderExtensions( |
| 365 const std::vector<RtpHeaderExtension>& extensions); |
| 366 |
366 WebRtcVoiceEngine* engine() { return engine_; } | 367 WebRtcVoiceEngine* engine() { return engine_; } |
367 int GetLastEngineError() { return engine()->GetLastEngineError(); } | 368 int GetLastEngineError() { return engine()->GetLastEngineError(); } |
368 int GetOutputLevel(int channel); | 369 int GetOutputLevel(int channel); |
369 bool GetRedSendCodec(const AudioCodec& red_codec, | 370 bool GetRedSendCodec(const AudioCodec& red_codec, |
370 const std::vector<AudioCodec>& all_codecs, | 371 const std::vector<AudioCodec>& all_codecs, |
371 webrtc::CodecInst* send_codec); | 372 webrtc::CodecInst* send_codec); |
372 bool EnableRtcp(int channel); | 373 bool EnableRtcp(int channel); |
373 bool ResetRecvCodecs(int channel); | 374 bool ResetRecvCodecs(int channel); |
374 bool SetPlayout(int channel, bool playout); | 375 bool SetPlayout(int channel, bool playout); |
375 static uint32 ParseSsrc(const void* data, size_t len, bool rtcp); | 376 static uint32 ParseSsrc(const void* data, size_t len, bool rtcp); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 456 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
456 | 457 |
457 // Do not lock this on the VoE media processor thread; potential for deadlock | 458 // Do not lock this on the VoE media processor thread; potential for deadlock |
458 // exists. | 459 // exists. |
459 mutable rtc::CriticalSection receive_channels_cs_; | 460 mutable rtc::CriticalSection receive_channels_cs_; |
460 }; | 461 }; |
461 | 462 |
462 } // namespace cricket | 463 } // namespace cricket |
463 | 464 |
464 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 465 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |