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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 bool AudioMixerImpl::AddSource(Source* audio_source) { | 273 bool AudioMixerImpl::AddSource(Source* audio_source) { |
274 RTC_DCHECK(audio_source); | 274 RTC_DCHECK(audio_source); |
275 rtc::CritScope lock(&crit_); | 275 rtc::CritScope lock(&crit_); |
276 RTC_DCHECK(FindSourceInList(audio_source, &audio_source_list_) == | 276 RTC_DCHECK(FindSourceInList(audio_source, &audio_source_list_) == |
277 audio_source_list_.end()) | 277 audio_source_list_.end()) |
278 << "Source already added to mixer"; | 278 << "Source already added to mixer"; |
279 audio_source_list_.emplace_back(new SourceStatus(audio_source, false, 0)); | 279 audio_source_list_.emplace_back(new SourceStatus(audio_source, false, 0)); |
280 return true; | 280 return true; |
281 } | 281 } |
282 | 282 |
283 bool AudioMixerImpl::RemoveSource(Source* audio_source) { | 283 void AudioMixerImpl::RemoveSource(Source* audio_source) { |
284 RTC_DCHECK(audio_source); | 284 RTC_DCHECK(audio_source); |
285 rtc::CritScope lock(&crit_); | 285 rtc::CritScope lock(&crit_); |
286 const auto iter = FindSourceInList(audio_source, &audio_source_list_); | 286 const auto iter = FindSourceInList(audio_source, &audio_source_list_); |
287 RTC_DCHECK(iter != audio_source_list_.end()) << "Source not present in mixer"; | 287 RTC_DCHECK(iter != audio_source_list_.end()) << "Source not present in mixer"; |
288 audio_source_list_.erase(iter); | 288 audio_source_list_.erase(iter); |
289 return true; | |
290 } | 289 } |
291 | 290 |
292 AudioFrameList AudioMixerImpl::GetAudioFromSources() { | 291 AudioFrameList AudioMixerImpl::GetAudioFromSources() { |
293 RTC_DCHECK_RUNS_SERIALIZED(&race_checker_); | 292 RTC_DCHECK_RUNS_SERIALIZED(&race_checker_); |
294 AudioFrameList result; | 293 AudioFrameList result; |
295 std::vector<SourceFrame> audio_source_mixing_data_list; | 294 std::vector<SourceFrame> audio_source_mixing_data_list; |
296 std::vector<SourceFrame> ramp_list; | 295 std::vector<SourceFrame> ramp_list; |
297 | 296 |
298 // Get audio from the audio sources and put it in the SourceFrame vector. | 297 // Get audio from the audio sources and put it in the SourceFrame vector. |
299 for (auto& source_and_status : audio_source_list_) { | 298 for (auto& source_and_status : audio_source_list_) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 374 |
376 const auto iter = FindSourceInList(audio_source, &audio_source_list_); | 375 const auto iter = FindSourceInList(audio_source, &audio_source_list_); |
377 if (iter != audio_source_list_.end()) { | 376 if (iter != audio_source_list_.end()) { |
378 return (*iter)->is_mixed; | 377 return (*iter)->is_mixed; |
379 } | 378 } |
380 | 379 |
381 LOG(LS_ERROR) << "Audio source unknown"; | 380 LOG(LS_ERROR) << "Audio source unknown"; |
382 return false; | 381 return false; |
383 } | 382 } |
384 } // namespace webrtc | 383 } // namespace webrtc |
OLD | NEW |