OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 "GetAudioFrame() was called on channel that is not playing."); | 146 "GetAudioFrame() was called on channel that is not playing."); |
147 return -1; | 147 return -1; |
148 } | 148 } |
149 if (desired_sample_rate_hz == -1) { | 149 if (desired_sample_rate_hz == -1) { |
150 shared_->SetLastError(VE_BAD_ARGUMENT, kTraceError, | 150 shared_->SetLastError(VE_BAD_ARGUMENT, kTraceError, |
151 "GetAudioFrame() was called with bad sample rate."); | 151 "GetAudioFrame() was called with bad sample rate."); |
152 return -1; | 152 return -1; |
153 } | 153 } |
154 frame->sample_rate_hz_ = | 154 frame->sample_rate_hz_ = |
155 desired_sample_rate_hz == 0 ? -1 : desired_sample_rate_hz; | 155 desired_sample_rate_hz == 0 ? -1 : desired_sample_rate_hz; |
156 return channelPtr->GetAudioFrame(channel, frame); | 156 auto ret = channelPtr->GetAudioFrameWithMuted(channel, frame); |
157 if (ret == MixerParticipant::AudioFrameInfo::kMuted) { | |
158 frame->Mute(); | |
minyue-webrtc
2016/05/17 14:59:17
I am confused, isn't this memset frame's samples t
hlundin-webrtc
2016/05/17 19:57:51
This is only the case in the VoEExternalMediaImpl,
minyue-webrtc
2016/05/18 01:31:30
Acknowledged.
| |
159 } | |
160 return ret == MixerParticipant::AudioFrameInfo::kError ? -1 : 0; | |
157 } | 161 } |
158 | 162 |
159 int VoEExternalMediaImpl::SetExternalMixing(int channel, bool enable) { | 163 int VoEExternalMediaImpl::SetExternalMixing(int channel, bool enable) { |
160 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, | 164 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, |
161 VoEId(shared_->instance_id(), channel), | 165 VoEId(shared_->instance_id(), channel), |
162 "SetExternalMixing(channel=%d, enable=%d)", channel, enable); | 166 "SetExternalMixing(channel=%d, enable=%d)", channel, enable); |
163 if (!shared_->statistics().Initialized()) { | 167 if (!shared_->statistics().Initialized()) { |
164 shared_->SetLastError(VE_NOT_INITED, kTraceError); | 168 shared_->SetLastError(VE_NOT_INITED, kTraceError); |
165 return -1; | 169 return -1; |
166 } | 170 } |
167 voe::ChannelOwner ch = shared_->channel_manager().GetChannel(channel); | 171 voe::ChannelOwner ch = shared_->channel_manager().GetChannel(channel); |
168 voe::Channel* channelPtr = ch.channel(); | 172 voe::Channel* channelPtr = ch.channel(); |
169 if (channelPtr == NULL) { | 173 if (channelPtr == NULL) { |
170 shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 174 shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
171 "SetExternalMixing() failed to locate channel"); | 175 "SetExternalMixing() failed to locate channel"); |
172 return -1; | 176 return -1; |
173 } | 177 } |
174 return channelPtr->SetExternalMixing(enable); | 178 return channelPtr->SetExternalMixing(enable); |
175 } | 179 } |
176 | 180 |
177 #endif // WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API | 181 #endif // WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API |
178 | 182 |
179 } // namespace webrtc | 183 } // namespace webrtc |
OLD | NEW |