| 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 } |
| 96 |
| 93 void MediaStreamSource::setAudioFormat(size_t numberOfChannels, | 97 void MediaStreamSource::setAudioFormat(size_t numberOfChannels, |
| 94 float sampleRate) { | 98 float sampleRate) { |
| 95 ASSERT(m_requiresConsumer); | 99 ASSERT(m_requiresConsumer); |
| 96 MutexLocker locker(m_audioConsumersLock); | 100 MutexLocker locker(m_audioConsumersLock); |
| 97 for (HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = | 101 for (HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = |
| 98 m_audioConsumers.begin(); | 102 m_audioConsumers.begin(); |
| 99 it != m_audioConsumers.end(); ++it) | 103 it != m_audioConsumers.end(); ++it) |
| 100 (*it)->setFormat(numberOfChannels, sampleRate); | 104 (*it)->setFormat(numberOfChannels, sampleRate); |
| 101 } | 105 } |
| 102 | 106 |
| 103 void MediaStreamSource::consumeAudio(AudioBus* bus, size_t numberOfFrames) { | 107 void MediaStreamSource::consumeAudio(AudioBus* bus, size_t numberOfFrames) { |
| 104 ASSERT(m_requiresConsumer); | 108 ASSERT(m_requiresConsumer); |
| 105 MutexLocker locker(m_audioConsumersLock); | 109 MutexLocker locker(m_audioConsumersLock); |
| 106 for (HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = | 110 for (HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = |
| 107 m_audioConsumers.begin(); | 111 m_audioConsumers.begin(); |
| 108 it != m_audioConsumers.end(); ++it) | 112 it != m_audioConsumers.end(); ++it) |
| 109 (*it)->consumeAudio(bus, numberOfFrames); | 113 (*it)->consumeAudio(bus, numberOfFrames); |
| 110 } | 114 } |
| 111 | 115 |
| 112 DEFINE_TRACE(MediaStreamSource) { | 116 DEFINE_TRACE(MediaStreamSource) { |
| 113 visitor->trace(m_observers); | 117 visitor->trace(m_observers); |
| 114 visitor->trace(m_audioConsumers); | 118 visitor->trace(m_audioConsumers); |
| 115 } | 119 } |
| 116 | 120 |
| 117 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |