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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 static PassRefPtr<MediaStreamComponent> create(PassRefPtr<MediaStreamSource>
); | 54 static PassRefPtr<MediaStreamComponent> create(PassRefPtr<MediaStreamSource>
); |
55 static PassRefPtr<MediaStreamComponent> create(const String& id, PassRefPtr<
MediaStreamSource>); | 55 static PassRefPtr<MediaStreamComponent> create(const String& id, PassRefPtr<
MediaStreamSource>); |
56 | 56 |
57 MediaStreamSource* source() const { return m_source.get(); } | 57 MediaStreamSource* source() const { return m_source.get(); } |
58 | 58 |
59 String id() const { return m_id; } | 59 String id() const { return m_id; } |
60 bool enabled() const { return m_enabled; } | 60 bool enabled() const { return m_enabled; } |
61 void setEnabled(bool enabled) { m_enabled = enabled; } | 61 void setEnabled(bool enabled) { m_enabled = enabled; } |
62 bool muted() const { return m_muted; } | 62 bool muted() const { return m_muted; } |
63 | 63 |
64 #if ENABLE(WEB_AUDIO) | |
65 AudioSourceProvider* audioSourceProvider() { return &m_sourceProvider; } | 64 AudioSourceProvider* audioSourceProvider() { return &m_sourceProvider; } |
66 void setSourceProvider(WebAudioSourceProvider* provider) { m_sourceProvider.
wrap(provider); } | 65 void setSourceProvider(WebAudioSourceProvider* provider) { m_sourceProvider.
wrap(provider); } |
67 #endif // ENABLE(WEB_AUDIO) | |
68 | 66 |
69 ExtraData* extraData() const { return m_extraData.get(); } | 67 ExtraData* extraData() const { return m_extraData.get(); } |
70 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = extraData
; } | 68 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = extraData
; } |
71 | 69 |
72 private: | 70 private: |
73 MediaStreamComponent(const String& id, PassRefPtr<MediaStreamSource>); | 71 MediaStreamComponent(const String& id, PassRefPtr<MediaStreamSource>); |
74 | 72 |
75 #if ENABLE(WEB_AUDIO) | |
76 // AudioSourceProviderImpl wraps a WebAudioSourceProvider::provideInput() | 73 // AudioSourceProviderImpl wraps a WebAudioSourceProvider::provideInput() |
77 // calls into chromium to get a rendered audio stream. | 74 // calls into chromium to get a rendered audio stream. |
78 | 75 |
79 class PLATFORM_EXPORT AudioSourceProviderImpl FINAL: public AudioSourceProvi
der { | 76 class PLATFORM_EXPORT AudioSourceProviderImpl FINAL: public AudioSourceProvi
der { |
80 public: | 77 public: |
81 AudioSourceProviderImpl() | 78 AudioSourceProviderImpl() |
82 : m_webAudioSourceProvider(0) | 79 : m_webAudioSourceProvider(0) |
83 { | 80 { |
84 } | 81 } |
85 | 82 |
86 virtual ~AudioSourceProviderImpl() { } | 83 virtual ~AudioSourceProviderImpl() { } |
87 | 84 |
88 // Wraps the given blink::WebAudioSourceProvider to blink::AudioSourcePr
ovider. | 85 // Wraps the given blink::WebAudioSourceProvider to blink::AudioSourcePr
ovider. |
89 void wrap(WebAudioSourceProvider*); | 86 void wrap(WebAudioSourceProvider*); |
90 | 87 |
91 // blink::AudioSourceProvider | 88 // blink::AudioSourceProvider |
92 virtual void provideInput(blink::AudioBus*, size_t framesToProcess) OVER
RIDE; | 89 virtual void provideInput(blink::AudioBus*, size_t framesToProcess) OVER
RIDE; |
93 | 90 |
94 private: | 91 private: |
95 WebAudioSourceProvider* m_webAudioSourceProvider; | 92 WebAudioSourceProvider* m_webAudioSourceProvider; |
96 Mutex m_provideInputLock; | 93 Mutex m_provideInputLock; |
97 }; | 94 }; |
98 | 95 |
99 AudioSourceProviderImpl m_sourceProvider; | 96 AudioSourceProviderImpl m_sourceProvider; |
100 #endif // ENABLE(WEB_AUDIO) | |
101 | 97 |
102 RefPtr<MediaStreamSource> m_source; | 98 RefPtr<MediaStreamSource> m_source; |
103 String m_id; | 99 String m_id; |
104 bool m_enabled; | 100 bool m_enabled; |
105 bool m_muted; | 101 bool m_muted; |
106 OwnPtr<ExtraData> m_extraData; | 102 OwnPtr<ExtraData> m_extraData; |
107 }; | 103 }; |
108 | 104 |
109 typedef Vector<RefPtr<MediaStreamComponent> > MediaStreamComponentVector; | 105 typedef Vector<RefPtr<MediaStreamComponent> > MediaStreamComponentVector; |
110 | 106 |
111 } // namespace blink | 107 } // namespace blink |
112 | 108 |
113 #endif // MediaStreamComponent_h | 109 #endif // MediaStreamComponent_h |
OLD | NEW |