Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 class BaseAudioContext; | 38 class BaseAudioContext; |
| 39 class HTMLMediaElement; | 39 class HTMLMediaElement; |
| 40 class MediaElementAudioSourceOptions; | 40 class MediaElementAudioSourceOptions; |
| 41 | 41 |
| 42 class MediaElementAudioSourceHandler final : public AudioHandler { | 42 class MediaElementAudioSourceHandler final : public AudioHandler { |
| 43 public: | 43 public: |
| 44 static PassRefPtr<MediaElementAudioSourceHandler> create(AudioNode&, | 44 static PassRefPtr<MediaElementAudioSourceHandler> create(AudioNode&, |
| 45 HTMLMediaElement&); | 45 HTMLMediaElement&); |
| 46 ~MediaElementAudioSourceHandler() override; | 46 ~MediaElementAudioSourceHandler() override; |
| 47 | 47 |
| 48 HTMLMediaElement* mediaElement() { return m_mediaElement.get(); } | 48 HTMLMediaElement* mediaElement() const; |
| 49 | 49 |
| 50 // AudioHandler | 50 // AudioHandler |
| 51 void dispose() override; | 51 void dispose() override; |
| 52 void process(size_t framesToProcess) override; | 52 void process(size_t framesToProcess) override; |
| 53 | 53 |
| 54 // Helpers for AudioSourceProviderClient implementation of | 54 // Helpers for AudioSourceProviderClient implementation of |
| 55 // MediaElementAudioSourceNode. | 55 // MediaElementAudioSourceNode. |
| 56 void setFormat(size_t numberOfChannels, float sampleRate); | 56 void setFormat(size_t numberOfChannels, float sampleRate); |
| 57 void onCurrentSrcChanged(const KURL& currentSrc); | 57 void onCurrentSrcChanged(const KURL& currentSrc); |
| 58 void lock(); | 58 void lock(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 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 | 72 // Print warning if CORS restrictions cause MediaElementAudioSource to output |
| 73 // zeroes. | 73 // zeroes. |
| 74 void printCORSMessage(const String& message); | 74 void printCORSMessage(const String& message); |
| 75 | 75 |
| 76 // This Persistent doesn't make a reference cycle. The reference from | 76 // This Persistent doesn't make a reference cycle. The reference from |
| 77 // HTMLMediaElement to AudioSourceProvideClient, which | 77 // HTMLMediaElement to AudioSourceProvideClient, which |
| 78 // MediaElementAudioSourceNode implements, is weak. | 78 // MediaElementAudioSourceNode implements, is weak. |
| 79 Persistent<HTMLMediaElement> m_mediaElement; | 79 // |
| 80 // It is accessed by both audio and main thread. | |
| 81 CrossThreadPersistent<HTMLMediaElement> m_mediaElement; | |
|
haraken
2017/02/20 23:57:18
Ditto.
| |
| 80 Mutex m_processLock; | 82 Mutex m_processLock; |
| 81 | 83 |
| 82 unsigned m_sourceNumberOfChannels; | 84 unsigned m_sourceNumberOfChannels; |
| 83 double m_sourceSampleRate; | 85 double m_sourceSampleRate; |
| 84 | 86 |
| 85 std::unique_ptr<MultiChannelResampler> m_multiChannelResampler; | 87 std::unique_ptr<MultiChannelResampler> m_multiChannelResampler; |
| 86 | 88 |
| 87 // |m_passesCurrentSrcCORSAccessCheck| holds the value of | 89 // |m_passesCurrentSrcCORSAccessCheck| holds the value of |
| 88 // context()->getSecurityOrigin() && | 90 // context()->getSecurityOrigin() && |
| 89 // context()->getSecurityOrigin()->canRequest(mediaElement()->currentSrc()), | 91 // context()->getSecurityOrigin()->canRequest(mediaElement()->currentSrc()), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 void lock() override; | 128 void lock() override; |
| 127 void unlock() override; | 129 void unlock() override; |
| 128 | 130 |
| 129 private: | 131 private: |
| 130 MediaElementAudioSourceNode(BaseAudioContext&, HTMLMediaElement&); | 132 MediaElementAudioSourceNode(BaseAudioContext&, HTMLMediaElement&); |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 } // namespace blink | 135 } // namespace blink |
| 134 | 136 |
| 135 #endif // MediaElementAudioSourceNode_h | 137 #endif // MediaElementAudioSourceNode_h |
| OLD | NEW |