| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 MutexLocker locker(audio_consumers_lock_); | 101 MutexLocker locker(audio_consumers_lock_); |
| 102 auto it = audio_consumers_.find(consumer); | 102 auto it = audio_consumers_.find(consumer); |
| 103 if (it == audio_consumers_.end()) | 103 if (it == audio_consumers_.end()) |
| 104 return false; | 104 return false; |
| 105 audio_consumers_.erase(it); | 105 audio_consumers_.erase(it); |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void MediaStreamSource::GetSettings(WebMediaStreamTrack::Settings& settings) { | 109 void MediaStreamSource::GetSettings(WebMediaStreamTrack::Settings& settings) { |
| 110 settings.device_id = Id(); | 110 settings.device_id = Id(); |
| 111 |
| 112 if (echo_cancellation_.has_value()) |
| 113 settings.echo_cancellation = *echo_cancellation_; |
| 111 } | 114 } |
| 112 | 115 |
| 113 void MediaStreamSource::SetAudioFormat(size_t number_of_channels, | 116 void MediaStreamSource::SetAudioFormat(size_t number_of_channels, |
| 114 float sample_rate) { | 117 float sample_rate) { |
| 115 DCHECK(requires_consumer_); | 118 DCHECK(requires_consumer_); |
| 116 MutexLocker locker(audio_consumers_lock_); | 119 MutexLocker locker(audio_consumers_lock_); |
| 117 for (AudioDestinationConsumer* consumer : audio_consumers_) | 120 for (AudioDestinationConsumer* consumer : audio_consumers_) |
| 118 consumer->SetFormat(number_of_channels, sample_rate); | 121 consumer->SetFormat(number_of_channels, sample_rate); |
| 119 } | 122 } |
| 120 | 123 |
| 121 void MediaStreamSource::ConsumeAudio(AudioBus* bus, size_t number_of_frames) { | 124 void MediaStreamSource::ConsumeAudio(AudioBus* bus, size_t number_of_frames) { |
| 122 DCHECK(requires_consumer_); | 125 DCHECK(requires_consumer_); |
| 123 MutexLocker locker(audio_consumers_lock_); | 126 MutexLocker locker(audio_consumers_lock_); |
| 124 for (AudioDestinationConsumer* consumer : audio_consumers_) | 127 for (AudioDestinationConsumer* consumer : audio_consumers_) |
| 125 consumer->ConsumeAudio(bus, number_of_frames); | 128 consumer->ConsumeAudio(bus, number_of_frames); |
| 126 } | 129 } |
| 127 | 130 |
| 128 DEFINE_TRACE(MediaStreamSource) { | 131 DEFINE_TRACE(MediaStreamSource) { |
| 129 visitor->Trace(observers_); | 132 visitor->Trace(observers_); |
| 130 } | 133 } |
| 131 | 134 |
| 132 } // namespace blink | 135 } // namespace blink |
| OLD | NEW |