OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 MediaElementAudioSourceHandler(AudioNode&, HTMLMediaElement&); | 62 MediaElementAudioSourceHandler(AudioNode&, HTMLMediaElement&); |
63 // As an audio source, we will never propagate silence. | 63 // As an audio source, we will never propagate silence. |
64 bool propagatesSilence() const override { return false; } | 64 bool propagatesSilence() const override { return false; } |
65 | 65 |
66 // Must be called only on the audio thread. | 66 // Must be called only on the audio thread. |
67 bool passesCORSAccessCheck(); | 67 bool passesCORSAccessCheck(); |
68 | 68 |
69 // Must be called only on the main thread. | 69 // Must be called only on the main thread. |
70 bool passesCurrentSrcCORSAccessCheck(const KURL& currentSrc); | 70 bool passesCurrentSrcCORSAccessCheck(const KURL& currentSrc); |
71 | 71 |
72 // Print warning if CORS restrictions cause MediaElementAudioSource to output
zeroes. | 72 // Print warning if CORS restrictions cause MediaElementAudioSource to output |
| 73 // zeroes. |
73 void printCORSMessage(const String& message); | 74 void printCORSMessage(const String& message); |
74 | 75 |
75 // This Persistent doesn't make a reference cycle. The reference from | 76 // This Persistent doesn't make a reference cycle. The reference from |
76 // HTMLMediaElement to AudioSourceProvideClient, which | 77 // HTMLMediaElement to AudioSourceProvideClient, which |
77 // MediaElementAudioSourceNode implements, is weak. | 78 // MediaElementAudioSourceNode implements, is weak. |
78 Persistent<HTMLMediaElement> m_mediaElement; | 79 Persistent<HTMLMediaElement> m_mediaElement; |
79 Mutex m_processLock; | 80 Mutex m_processLock; |
80 | 81 |
81 unsigned m_sourceNumberOfChannels; | 82 unsigned m_sourceNumberOfChannels; |
82 double m_sourceSampleRate; | 83 double m_sourceSampleRate; |
83 | 84 |
84 std::unique_ptr<MultiChannelResampler> m_multiChannelResampler; | 85 std::unique_ptr<MultiChannelResampler> m_multiChannelResampler; |
85 | 86 |
86 // |m_passesCurrentSrcCORSAccessCheck| holds the value of | 87 // |m_passesCurrentSrcCORSAccessCheck| holds the value of |
87 // context()->getSecurityOrigin() && context()->getSecurityOrigin()->canReques
t(mediaElement()->currentSrc()), | 88 // context()->getSecurityOrigin() && |
88 // updated in the ctor and onCurrentSrcChanged() on the main thread and | 89 // context()->getSecurityOrigin()->canRequest(mediaElement()->currentSrc()), |
89 // used in passesCORSAccessCheck() on the audio thread, | 90 // updated in the ctor and onCurrentSrcChanged() on the main thread and used |
90 // protected by |m_processLock|. | 91 // in passesCORSAccessCheck() on the audio thread, protected by |
| 92 // |m_processLock|. |
91 bool m_passesCurrentSrcCORSAccessCheck; | 93 bool m_passesCurrentSrcCORSAccessCheck; |
92 | 94 |
93 // Indicates if we need to print a CORS message if the current source has chan
ged and we have no | 95 // Indicates if we need to print a CORS message if the current source has |
94 // access to it. Must be protected by |m_processLock|. | 96 // changed and we have no access to it. Must be protected by |m_processLock|. |
95 bool m_maybePrintCORSMessage; | 97 bool m_maybePrintCORSMessage; |
96 | 98 |
97 // The value of mediaElement()->currentSrc().string() in the ctor and onCurren
tSrcChanged(). | 99 // The value of mediaElement()->currentSrc().string() in the ctor and |
98 // Protected by |m_processLock|. | 100 // onCurrentSrcChanged(). Protected by |m_processLock|. |
99 String m_currentSrcString; | 101 String m_currentSrcString; |
100 }; | 102 }; |
101 | 103 |
102 class MediaElementAudioSourceNode final : public AudioSourceNode, | 104 class MediaElementAudioSourceNode final : public AudioSourceNode, |
103 public AudioSourceProviderClient { | 105 public AudioSourceProviderClient { |
104 DEFINE_WRAPPERTYPEINFO(); | 106 DEFINE_WRAPPERTYPEINFO(); |
105 USING_GARBAGE_COLLECTED_MIXIN(MediaElementAudioSourceNode); | 107 USING_GARBAGE_COLLECTED_MIXIN(MediaElementAudioSourceNode); |
106 | 108 |
107 public: | 109 public: |
108 static MediaElementAudioSourceNode* create(BaseAudioContext&, | 110 static MediaElementAudioSourceNode* create(BaseAudioContext&, |
(...skipping 15 matching lines...) Expand all Loading... |
124 void lock() override; | 126 void lock() override; |
125 void unlock() override; | 127 void unlock() override; |
126 | 128 |
127 private: | 129 private: |
128 MediaElementAudioSourceNode(BaseAudioContext&, HTMLMediaElement&); | 130 MediaElementAudioSourceNode(BaseAudioContext&, HTMLMediaElement&); |
129 }; | 131 }; |
130 | 132 |
131 } // namespace blink | 133 } // namespace blink |
132 | 134 |
133 #endif // MediaElementAudioSourceNode_h | 135 #endif // MediaElementAudioSourceNode_h |
OLD | NEW |