| 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 voe_wrapper_->base()->Terminate(); | 574 voe_wrapper_->base()->Terminate(); |
| 575 desired_local_monitor_enable_ = false; | 575 desired_local_monitor_enable_ = false; |
| 576 } | 576 } |
| 577 | 577 |
| 578 int WebRtcVoiceEngine::GetCapabilities() { | 578 int WebRtcVoiceEngine::GetCapabilities() { |
| 579 return AUDIO_SEND | AUDIO_RECV; | 579 return AUDIO_SEND | AUDIO_RECV; |
| 580 } | 580 } |
| 581 | 581 |
| 582 VoiceMediaChannel* WebRtcVoiceEngine::CreateChannel(webrtc::Call* call, | 582 VoiceMediaChannel* WebRtcVoiceEngine::CreateChannel(webrtc::Call* call, |
| 583 const AudioOptions& options) { | 583 const AudioOptions& options) { |
| 584 WebRtcVoiceMediaChannel* ch = new WebRtcVoiceMediaChannel(this, call); | 584 WebRtcVoiceMediaChannel* ch = |
| 585 new WebRtcVoiceMediaChannel(this, options, call); |
| 585 if (!ch->valid()) { | 586 if (!ch->valid()) { |
| 586 delete ch; | 587 delete ch; |
| 587 return nullptr; | 588 return nullptr; |
| 588 } | 589 } |
| 589 if (!ch->SetOptions(options)) { | |
| 590 LOG(LS_WARNING) << "Failed to set options while creating channel."; | |
| 591 } | |
| 592 return ch; | 590 return ch; |
| 593 } | 591 } |
| 594 | 592 |
| 595 bool WebRtcVoiceEngine::SetOptions(const AudioOptions& options) { | 593 bool WebRtcVoiceEngine::SetOptions(const AudioOptions& options) { |
| 596 if (!ApplyOptions(options)) { | 594 if (!ApplyOptions(options)) { |
| 597 return false; | 595 return false; |
| 598 } | 596 } |
| 599 options_ = options; | 597 options_ = options; |
| 600 return true; | 598 return true; |
| 601 } | 599 } |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 // PeerConnection will make sure invalidating the pointer before the object | 1681 // PeerConnection will make sure invalidating the pointer before the object |
| 1684 // goes away. | 1682 // goes away. |
| 1685 AudioRenderer* renderer_; | 1683 AudioRenderer* renderer_; |
| 1686 | 1684 |
| 1687 // Protects |renderer_| in Start(), Stop() and OnClose(). | 1685 // Protects |renderer_| in Start(), Stop() and OnClose(). |
| 1688 rtc::CriticalSection lock_; | 1686 rtc::CriticalSection lock_; |
| 1689 }; | 1687 }; |
| 1690 | 1688 |
| 1691 // WebRtcVoiceMediaChannel | 1689 // WebRtcVoiceMediaChannel |
| 1692 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, | 1690 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, |
| 1691 const AudioOptions& options, |
| 1693 webrtc::Call* call) | 1692 webrtc::Call* call) |
| 1694 : engine_(engine), | 1693 : engine_(engine), |
| 1695 voe_channel_(engine->CreateMediaVoiceChannel()), | 1694 voe_channel_(engine->CreateMediaVoiceChannel()), |
| 1696 send_bitrate_setting_(false), | 1695 send_bitrate_setting_(false), |
| 1697 send_bitrate_bps_(0), | 1696 send_bitrate_bps_(0), |
| 1698 options_(), | 1697 options_(), |
| 1699 dtmf_allowed_(false), | 1698 dtmf_allowed_(false), |
| 1700 desired_playout_(false), | 1699 desired_playout_(false), |
| 1701 nack_enabled_(false), | 1700 nack_enabled_(false), |
| 1702 playout_(false), | 1701 playout_(false), |
| 1703 typing_noise_detected_(false), | 1702 typing_noise_detected_(false), |
| 1704 desired_send_(SEND_NOTHING), | 1703 desired_send_(SEND_NOTHING), |
| 1705 send_(SEND_NOTHING), | 1704 send_(SEND_NOTHING), |
| 1706 call_(call), | 1705 call_(call), |
| 1707 default_receive_ssrc_(0) { | 1706 default_receive_ssrc_(0) { |
| 1708 engine->RegisterChannel(this); | 1707 engine->RegisterChannel(this); |
| 1709 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel " | 1708 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel " |
| 1710 << voe_channel(); | 1709 << voe_channel(); |
| 1711 RTC_DCHECK(nullptr != call); | 1710 RTC_DCHECK(nullptr != call); |
| 1712 ConfigureSendChannel(voe_channel()); | 1711 ConfigureSendChannel(voe_channel()); |
| 1712 SetOptions(options); |
| 1713 } | 1713 } |
| 1714 | 1714 |
| 1715 WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel() { | 1715 WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel() { |
| 1716 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel " | 1716 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel " |
| 1717 << voe_channel(); | 1717 << voe_channel(); |
| 1718 | 1718 |
| 1719 // Remove any remaining send streams, the default channel will be deleted | 1719 // Remove any remaining send streams, the default channel will be deleted |
| 1720 // later. | 1720 // later. |
| 1721 while (!send_channels_.empty()) | 1721 while (!send_channels_.empty()) |
| 1722 RemoveSendStream(send_channels_.begin()->first); | 1722 RemoveSendStream(send_channels_.begin()->first); |
| (...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3625 | 3625 |
| 3626 int WebRtcSoundclipStream::Rewind() { | 3626 int WebRtcSoundclipStream::Rewind() { |
| 3627 mem_.Rewind(); | 3627 mem_.Rewind(); |
| 3628 // Return -1 to keep VoiceEngine from looping. | 3628 // Return -1 to keep VoiceEngine from looping. |
| 3629 return (loop_) ? 0 : -1; | 3629 return (loop_) ? 0 : -1; |
| 3630 } | 3630 } |
| 3631 | 3631 |
| 3632 } // namespace cricket | 3632 } // namespace cricket |
| 3633 | 3633 |
| 3634 #endif // HAVE_WEBRTC_VOICE | 3634 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |