| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 ASSERT(m_requiresConsumer); | 83 ASSERT(m_requiresConsumer); |
| 84 MutexLocker locker(m_audioConsumersLock); | 84 MutexLocker locker(m_audioConsumersLock); |
| 85 HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = | 85 HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = |
| 86 m_audioConsumers.find(consumer); | 86 m_audioConsumers.find(consumer); |
| 87 if (it == m_audioConsumers.end()) | 87 if (it == m_audioConsumers.end()) |
| 88 return false; | 88 return false; |
| 89 m_audioConsumers.remove(it); | 89 m_audioConsumers.remove(it); |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void MediaStreamSource::getSettings(WebMediaStreamTrack::Settings& settings) { |
| 94 settings.deviceId = id(); |
| 95 m_extraData->getSettings(settings); |
| 96 } |
| 97 |
| 93 void MediaStreamSource::setAudioFormat(size_t numberOfChannels, | 98 void MediaStreamSource::setAudioFormat(size_t numberOfChannels, |
| 94 float sampleRate) { | 99 float sampleRate) { |
| 95 ASSERT(m_requiresConsumer); | 100 ASSERT(m_requiresConsumer); |
| 96 MutexLocker locker(m_audioConsumersLock); | 101 MutexLocker locker(m_audioConsumersLock); |
| 97 for (HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = | 102 for (HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = |
| 98 m_audioConsumers.begin(); | 103 m_audioConsumers.begin(); |
| 99 it != m_audioConsumers.end(); ++it) | 104 it != m_audioConsumers.end(); ++it) |
| 100 (*it)->setFormat(numberOfChannels, sampleRate); | 105 (*it)->setFormat(numberOfChannels, sampleRate); |
| 101 } | 106 } |
| 102 | 107 |
| 103 void MediaStreamSource::consumeAudio(AudioBus* bus, size_t numberOfFrames) { | 108 void MediaStreamSource::consumeAudio(AudioBus* bus, size_t numberOfFrames) { |
| 104 ASSERT(m_requiresConsumer); | 109 ASSERT(m_requiresConsumer); |
| 105 MutexLocker locker(m_audioConsumersLock); | 110 MutexLocker locker(m_audioConsumersLock); |
| 106 for (HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = | 111 for (HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = |
| 107 m_audioConsumers.begin(); | 112 m_audioConsumers.begin(); |
| 108 it != m_audioConsumers.end(); ++it) | 113 it != m_audioConsumers.end(); ++it) |
| 109 (*it)->consumeAudio(bus, numberOfFrames); | 114 (*it)->consumeAudio(bus, numberOfFrames); |
| 110 } | 115 } |
| 111 | 116 |
| 112 DEFINE_TRACE(MediaStreamSource) { | 117 DEFINE_TRACE(MediaStreamSource) { |
| 113 visitor->trace(m_observers); | 118 visitor->trace(m_observers); |
| 114 visitor->trace(m_audioConsumers); | 119 visitor->trace(m_audioConsumers); |
| 115 } | 120 } |
| 116 | 121 |
| 117 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |