OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // So this class runs pre-finalizer to finalize |m_extraData| promptly. | 61 // So this class runs pre-finalizer to finalize |m_extraData| promptly. |
62 void dispose(); | 62 void dispose(); |
63 | 63 |
64 MediaStreamSource* source() const { return m_source.get(); } | 64 MediaStreamSource* source() const { return m_source.get(); } |
65 | 65 |
66 String id() const { return m_id; } | 66 String id() const { return m_id; } |
67 bool enabled() const { return m_enabled; } | 67 bool enabled() const { return m_enabled; } |
68 void setEnabled(bool enabled) { m_enabled = enabled; } | 68 void setEnabled(bool enabled) { m_enabled = enabled; } |
69 bool muted() const { return m_muted; } | 69 bool muted() const { return m_muted; } |
70 void setMuted(bool muted) { m_muted = muted; } | 70 void setMuted(bool muted) { m_muted = muted; } |
71 | |
72 #if ENABLE(WEB_AUDIO) | |
73 AudioSourceProvider* audioSourceProvider() { return &m_sourceProvider; } | 71 AudioSourceProvider* audioSourceProvider() { return &m_sourceProvider; } |
74 void setSourceProvider(WebAudioSourceProvider* provider) { m_sourceProvider.
wrap(provider); } | 72 void setSourceProvider(WebAudioSourceProvider* provider) { m_sourceProvider.
wrap(provider); } |
75 #endif // ENABLE(WEB_AUDIO) | |
76 | 73 |
77 ExtraData* extraData() const { return m_extraData.get(); } | 74 ExtraData* extraData() const { return m_extraData.get(); } |
78 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = std::move
(extraData); } | 75 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = std::move
(extraData); } |
79 | 76 |
80 DECLARE_TRACE(); | 77 DECLARE_TRACE(); |
81 | 78 |
82 private: | 79 private: |
83 MediaStreamComponent(const String& id, MediaStreamSource*); | 80 MediaStreamComponent(const String& id, MediaStreamSource*); |
84 | 81 |
85 #if ENABLE(WEB_AUDIO) | |
86 // AudioSourceProviderImpl wraps a WebAudioSourceProvider::provideInput() | 82 // AudioSourceProviderImpl wraps a WebAudioSourceProvider::provideInput() |
87 // calls into chromium to get a rendered audio stream. | 83 // calls into chromium to get a rendered audio stream. |
88 | 84 |
89 class PLATFORM_EXPORT AudioSourceProviderImpl final: public AudioSourceProvi
der { | 85 class PLATFORM_EXPORT AudioSourceProviderImpl final: public AudioSourceProvi
der { |
90 public: | 86 public: |
91 AudioSourceProviderImpl() | 87 AudioSourceProviderImpl() |
92 : m_webAudioSourceProvider(0) | 88 : m_webAudioSourceProvider(0) |
93 { | 89 { |
94 } | 90 } |
95 | 91 |
96 ~AudioSourceProviderImpl() override {} | 92 ~AudioSourceProviderImpl() override {} |
97 | 93 |
98 // Wraps the given blink::WebAudioSourceProvider to blink::AudioSourcePr
ovider. | 94 // Wraps the given blink::WebAudioSourceProvider to blink::AudioSourcePr
ovider. |
99 void wrap(WebAudioSourceProvider*); | 95 void wrap(WebAudioSourceProvider*); |
100 | 96 |
101 // blink::AudioSourceProvider | 97 // blink::AudioSourceProvider |
102 void provideInput(AudioBus*, size_t framesToProcess) override; | 98 void provideInput(AudioBus*, size_t framesToProcess) override; |
103 | 99 |
104 private: | 100 private: |
105 WebAudioSourceProvider* m_webAudioSourceProvider; | 101 WebAudioSourceProvider* m_webAudioSourceProvider; |
106 Mutex m_provideInputLock; | 102 Mutex m_provideInputLock; |
107 }; | 103 }; |
108 | 104 |
109 AudioSourceProviderImpl m_sourceProvider; | 105 AudioSourceProviderImpl m_sourceProvider; |
110 #endif // ENABLE(WEB_AUDIO) | |
111 | |
112 Member<MediaStreamSource> m_source; | 106 Member<MediaStreamSource> m_source; |
113 String m_id; | 107 String m_id; |
114 bool m_enabled; | 108 bool m_enabled; |
115 bool m_muted; | 109 bool m_muted; |
116 OwnPtr<ExtraData> m_extraData; | 110 OwnPtr<ExtraData> m_extraData; |
117 }; | 111 }; |
118 | 112 |
119 typedef HeapVector<Member<MediaStreamComponent>> MediaStreamComponentVector; | 113 typedef HeapVector<Member<MediaStreamComponent>> MediaStreamComponentVector; |
120 | 114 |
121 } // namespace blink | 115 } // namespace blink |
122 | 116 |
123 #endif // MediaStreamComponent_h | 117 #endif // MediaStreamComponent_h |
OLD | NEW |