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( | 582 VoiceMediaChannel* WebRtcVoiceEngine::CreateChannel( |
583 const AudioOptions& options) { | 583 const AudioOptions& options) { |
584 WebRtcVoiceMediaChannel* ch = new WebRtcVoiceMediaChannel(this); | 584 WebRtcVoiceMediaChannel* ch = new WebRtcVoiceMediaChannel(this, options); |
585 if (!ch->valid()) { | 585 if (!ch->valid()) { |
586 delete ch; | 586 delete ch; |
587 return nullptr; | 587 return nullptr; |
588 } | 588 } |
589 if (!ch->SetOptions(options)) { | |
590 LOG(LS_WARNING) << "Failed to set options while creating channel."; | |
591 } | |
592 return ch; | 589 return ch; |
593 } | 590 } |
594 | 591 |
595 bool WebRtcVoiceEngine::SetOptions(const AudioOptions& options) { | 592 bool WebRtcVoiceEngine::SetOptions(const AudioOptions& options) { |
596 if (!ApplyOptions(options)) { | 593 if (!ApplyOptions(options)) { |
597 return false; | 594 return false; |
598 } | 595 } |
599 options_ = options; | 596 options_ = options; |
600 return true; | 597 return true; |
601 } | 598 } |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1682 // Raw pointer to AudioRenderer owned by LocalAudioTrackHandler. | 1679 // Raw pointer to AudioRenderer owned by LocalAudioTrackHandler. |
1683 // PeerConnection will make sure invalidating the pointer before the object | 1680 // PeerConnection will make sure invalidating the pointer before the object |
1684 // goes away. | 1681 // goes away. |
1685 AudioRenderer* renderer_; | 1682 AudioRenderer* renderer_; |
1686 | 1683 |
1687 // Protects |renderer_| in Start(), Stop() and OnClose(). | 1684 // Protects |renderer_| in Start(), Stop() and OnClose(). |
1688 rtc::CriticalSection lock_; | 1685 rtc::CriticalSection lock_; |
1689 }; | 1686 }; |
1690 | 1687 |
1691 // WebRtcVoiceMediaChannel | 1688 // WebRtcVoiceMediaChannel |
1692 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine) | 1689 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, |
1690 const AudioOptions& options) | |
1693 : engine_(engine), | 1691 : engine_(engine), |
1694 voe_channel_(engine->CreateMediaVoiceChannel()), | 1692 voe_channel_(engine->CreateMediaVoiceChannel()), |
1695 send_bitrate_setting_(false), | 1693 send_bitrate_setting_(false), |
1696 send_bitrate_bps_(0), | 1694 send_bitrate_bps_(0), |
1697 options_(), | 1695 options_(), |
1698 dtmf_allowed_(false), | 1696 dtmf_allowed_(false), |
1699 desired_playout_(false), | 1697 desired_playout_(false), |
1700 nack_enabled_(false), | 1698 nack_enabled_(false), |
1701 playout_(false), | 1699 playout_(false), |
1702 typing_noise_detected_(false), | 1700 typing_noise_detected_(false), |
1703 desired_send_(SEND_NOTHING), | 1701 desired_send_(SEND_NOTHING), |
1704 send_(SEND_NOTHING), | 1702 send_(SEND_NOTHING), |
1705 call_(nullptr), | 1703 call_(nullptr), |
1706 default_receive_ssrc_(0) { | 1704 default_receive_ssrc_(0) { |
1707 engine->RegisterChannel(this); | 1705 engine->RegisterChannel(this); |
1708 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel " | 1706 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel " |
1709 << voe_channel(); | 1707 << voe_channel(); |
1710 ConfigureSendChannel(voe_channel()); | 1708 ConfigureSendChannel(voe_channel()); |
1709 SetOptions(options); | |
1711 } | 1710 } |
1712 | 1711 |
1713 WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel() { | 1712 WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel() { |
1714 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel " | 1713 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel " |
1715 << voe_channel(); | 1714 << voe_channel(); |
1716 DCHECK(receive_streams_.empty() || call_); | 1715 DCHECK(receive_streams_.empty() || call_); |
1717 | 1716 |
1718 // Remove any remaining send streams, the default channel will be deleted | 1717 // Remove any remaining send streams, the default channel will be deleted |
1719 // later. | 1718 // later. |
1720 while (!send_channels_.empty()) | 1719 while (!send_channels_.empty()) |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2086 return false; | 2085 return false; |
2087 } | 2086 } |
2088 } | 2087 } |
2089 } | 2088 } |
2090 } | 2089 } |
2091 return true; | 2090 return true; |
2092 } | 2091 } |
2093 | 2092 |
2094 bool WebRtcVoiceMediaChannel::SetSendCodecs( | 2093 bool WebRtcVoiceMediaChannel::SetSendCodecs( |
2095 const std::vector<AudioCodec>& codecs) { | 2094 const std::vector<AudioCodec>& codecs) { |
2095 // Don't change any state if codec list is empty. | |
2096 if (codecs.empty()) { | |
2097 return true; | |
2098 } | |
pthatcher1
2015/09/14 19:42:02
Same here
| |
2099 | |
2096 dtmf_allowed_ = false; | 2100 dtmf_allowed_ = false; |
2097 for (const AudioCodec& codec : codecs) { | 2101 for (const AudioCodec& codec : codecs) { |
2098 // Find the DTMF telephone event "codec". | 2102 // Find the DTMF telephone event "codec". |
2099 if (IsCodec(codec, kDtmfCodecName)) { | 2103 if (IsCodec(codec, kDtmfCodecName)) { |
2100 dtmf_allowed_ = true; | 2104 dtmf_allowed_ = true; |
2101 } | 2105 } |
2102 } | 2106 } |
2103 | 2107 |
2104 // Cache the codecs in order to configure the channel created later. | 2108 // Cache the codecs in order to configure the channel created later. |
2105 send_codecs_ = codecs; | 2109 send_codecs_ = codecs; |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3639 | 3643 |
3640 int WebRtcSoundclipStream::Rewind() { | 3644 int WebRtcSoundclipStream::Rewind() { |
3641 mem_.Rewind(); | 3645 mem_.Rewind(); |
3642 // Return -1 to keep VoiceEngine from looping. | 3646 // Return -1 to keep VoiceEngine from looping. |
3643 return (loop_) ? 0 : -1; | 3647 return (loop_) ? 0 : -1; |
3644 } | 3648 } |
3645 | 3649 |
3646 } // namespace cricket | 3650 } // namespace cricket |
3647 | 3651 |
3648 #endif // HAVE_WEBRTC_VOICE | 3652 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |