Chromium Code Reviews| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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); |
| 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)) { | 589 // TODO(solenberg): !!!!! SetParameters with only options? |
| 590 LOG(LS_WARNING) << "Failed to set options while creating channel."; | 590 // if (!ch->SetOptions(options)) { |
| 591 } | 591 // LOG(LS_WARNING) << "Failed to set options while creating channel."; |
| 592 // } | |
|
pthatcher1
2015/09/04 23:21:16
Same here: they just need to be remembered for lat
the sun
2015/09/11 15:03:03
Done.
| |
| 592 return ch; | 593 return ch; |
| 593 } | 594 } |
| 594 | 595 |
| 595 bool WebRtcVoiceEngine::SetOptions(const AudioOptions& options) { | 596 bool WebRtcVoiceEngine::SetOptions(const AudioOptions& options) { |
| 596 if (!ApplyOptions(options)) { | 597 if (!ApplyOptions(options)) { |
| 597 return false; | 598 return false; |
| 598 } | 599 } |
| 599 options_ = options; | 600 options_ = options; |
| 600 return true; | 601 return true; |
| 601 } | 602 } |
| (...skipping 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3058 // Make sure not sending the same packet to default channel more than once. | 3059 // Make sure not sending the same packet to default channel more than once. |
| 3059 if (IsDefaultChannel(ch.second->channel()) && | 3060 if (IsDefaultChannel(ch.second->channel()) && |
| 3060 has_sent_to_default_channel) | 3061 has_sent_to_default_channel) |
| 3061 continue; | 3062 continue; |
| 3062 | 3063 |
| 3063 engine()->voe()->network()->ReceivedRTCPPacket( | 3064 engine()->voe()->network()->ReceivedRTCPPacket( |
| 3064 ch.second->channel(), packet->data(), packet->size()); | 3065 ch.second->channel(), packet->data(), packet->size()); |
| 3065 } | 3066 } |
| 3066 } | 3067 } |
| 3067 | 3068 |
| 3068 bool WebRtcVoiceMediaChannel::MuteStream(uint32 ssrc, bool muted) { | 3069 bool WebRtcVoiceMediaChannel::MuteStream(uint32 ssrc, bool mute, |
| 3070 const AudioOptions* options) { | |
| 3069 int channel = (ssrc == 0) ? voe_channel() : GetSendChannelNum(ssrc); | 3071 int channel = (ssrc == 0) ? voe_channel() : GetSendChannelNum(ssrc); |
| 3070 if (channel == -1) { | 3072 if (channel == -1) { |
| 3071 LOG(LS_WARNING) << "The specified ssrc " << ssrc << " is not in use."; | 3073 LOG(LS_WARNING) << "The specified ssrc " << ssrc << " is not in use."; |
| 3072 return false; | 3074 return false; |
| 3073 } | 3075 } |
| 3074 if (engine()->voe()->volume()->SetInputMute(channel, muted) == -1) { | 3076 if (engine()->voe()->volume()->SetInputMute(channel, mute) == -1) { |
| 3075 LOG_RTCERR2(SetInputMute, channel, muted); | 3077 LOG_RTCERR2(SetInputMute, channel, mute); |
| 3076 return false; | 3078 return false; |
| 3077 } | 3079 } |
| 3078 // We set the AGC to mute state only when all the channels are muted. | 3080 // We set the AGC to mute state only when all the channels are muted. |
| 3079 // This implementation is not ideal, instead we should signal the AGC when | 3081 // This implementation is not ideal, instead we should signal the AGC when |
| 3080 // the mic channel is muted/unmuted. We can't do it today because there | 3082 // the mic channel is muted/unmuted. We can't do it today because there |
| 3081 // is no good way to know which stream is mapping to the mic channel. | 3083 // is no good way to know which stream is mapping to the mic channel. |
| 3082 bool all_muted = muted; | 3084 bool all_muted = mute; |
| 3083 for (const auto& ch : send_channels_) { | 3085 for (const auto& ch : send_channels_) { |
| 3084 if (!all_muted) { | 3086 if (!all_muted) { |
| 3085 break; | 3087 break; |
| 3086 } | 3088 } |
| 3087 if (engine()->voe()->volume()->GetInputMute(ch.second->channel(), | 3089 if (engine()->voe()->volume()->GetInputMute(ch.second->channel(), |
| 3088 all_muted)) { | 3090 all_muted)) { |
| 3089 LOG_RTCERR1(GetInputMute, ch.second->channel()); | 3091 LOG_RTCERR1(GetInputMute, ch.second->channel()); |
| 3090 return false; | 3092 return false; |
| 3091 } | 3093 } |
| 3092 } | 3094 } |
| 3093 | 3095 |
| 3094 webrtc::AudioProcessing* ap = engine()->voe()->base()->audio_processing(); | 3096 webrtc::AudioProcessing* ap = engine()->voe()->base()->audio_processing(); |
| 3095 if (ap) | 3097 if (ap) |
| 3096 ap->set_output_will_be_muted(all_muted); | 3098 ap->set_output_will_be_muted(all_muted); |
| 3097 return true; | 3099 |
| 3100 if (!mute && options) { | |
| 3101 return SetOptions(*options); | |
| 3102 } else { | |
| 3103 return true; | |
| 3104 } | |
| 3098 } | 3105 } |
| 3099 | 3106 |
| 3100 // TODO(minyue): SetMaxSendBandwidth() is subject to be renamed to | 3107 // TODO(minyue): SetMaxSendBandwidth() is subject to be renamed to |
| 3101 // SetMaxSendBitrate() in future. | 3108 // SetMaxSendBitrate() in future. |
| 3102 bool WebRtcVoiceMediaChannel::SetMaxSendBandwidth(int bps) { | 3109 bool WebRtcVoiceMediaChannel::SetMaxSendBandwidth(int bps) { |
| 3103 LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetMaxSendBandwidth."; | 3110 LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetMaxSendBandwidth."; |
| 3104 | 3111 |
| 3105 return SetSendBitrateInternal(bps); | 3112 return SetSendBitrateInternal(bps); |
| 3106 } | 3113 } |
| 3107 | 3114 |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3647 | 3654 |
| 3648 int WebRtcSoundclipStream::Rewind() { | 3655 int WebRtcSoundclipStream::Rewind() { |
| 3649 mem_.Rewind(); | 3656 mem_.Rewind(); |
| 3650 // Return -1 to keep VoiceEngine from looping. | 3657 // Return -1 to keep VoiceEngine from looping. |
| 3651 return (loop_) ? 0 : -1; | 3658 return (loop_) ? 0 : -1; |
| 3652 } | 3659 } |
| 3653 | 3660 |
| 3654 } // namespace cricket | 3661 } // namespace cricket |
| 3655 | 3662 |
| 3656 #endif // HAVE_WEBRTC_VOICE | 3663 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |