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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 StreamType type, | 44 StreamType type, |
45 const String& name, | 45 const String& name, |
46 ReadyState readyState, | 46 ReadyState readyState, |
47 bool requiresConsumer) | 47 bool requiresConsumer) |
48 : m_id(id), | 48 : m_id(id), |
49 m_type(type), | 49 m_type(type), |
50 m_name(name), | 50 m_name(name), |
51 m_readyState(readyState), | 51 m_readyState(readyState), |
52 m_requiresConsumer(requiresConsumer) {} | 52 m_requiresConsumer(requiresConsumer) {} |
53 | 53 |
54 MediaStreamSource::~MediaStreamSource() { | |
55 // Verify that the audio thread isn't consuming audio. | |
56 // TODO(sof): remove once crbug.com/682945 has been diagnosed. | |
57 MutexTryLocker tryLocker(m_audioConsumersLock); | |
58 CHECK(tryLocker.locked()); | |
59 } | |
60 | |
61 void MediaStreamSource::setReadyState(ReadyState readyState) { | 54 void MediaStreamSource::setReadyState(ReadyState readyState) { |
62 if (m_readyState != ReadyStateEnded && m_readyState != readyState) { | 55 if (m_readyState != ReadyStateEnded && m_readyState != readyState) { |
63 m_readyState = readyState; | 56 m_readyState = readyState; |
64 | 57 |
65 // Observers may dispatch events which create and add new Observers; | 58 // Observers may dispatch events which create and add new Observers; |
66 // take a snapshot so as to safely iterate. | 59 // take a snapshot so as to safely iterate. |
67 HeapVector<Member<Observer>> observers; | 60 HeapVector<Member<Observer>> observers; |
68 copyToVector(m_observers, observers); | 61 copyToVector(m_observers, observers); |
69 for (auto observer : observers) | 62 for (auto observer : observers) |
70 observer->sourceChangedState(); | 63 observer->sourceChangedState(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 MutexLocker locker(m_audioConsumersLock); | 102 MutexLocker locker(m_audioConsumersLock); |
110 for (AudioDestinationConsumer* consumer : m_audioConsumers) | 103 for (AudioDestinationConsumer* consumer : m_audioConsumers) |
111 consumer->consumeAudio(bus, numberOfFrames); | 104 consumer->consumeAudio(bus, numberOfFrames); |
112 } | 105 } |
113 | 106 |
114 DEFINE_TRACE(MediaStreamSource) { | 107 DEFINE_TRACE(MediaStreamSource) { |
115 visitor->trace(m_observers); | 108 visitor->trace(m_observers); |
116 } | 109 } |
117 | 110 |
118 } // namespace blink | 111 } // namespace blink |
OLD | NEW |