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 24 matching lines...) Expand all Loading... |
35 #include "wtf/ThreadingPrimitives.h" | 35 #include "wtf/ThreadingPrimitives.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class AudioContext; | 39 class AudioContext; |
40 class HTMLMediaElement; | 40 class HTMLMediaElement; |
41 | 41 |
42 class MediaElementAudioSourceHandler final : public AudioHandler { | 42 class MediaElementAudioSourceHandler final : public AudioHandler { |
43 public: | 43 public: |
44 static PassRefPtr<MediaElementAudioSourceHandler> create(AudioNode&, HTMLMed
iaElement&); | 44 static PassRefPtr<MediaElementAudioSourceHandler> create(AudioNode&, HTMLMed
iaElement&); |
45 virtual ~MediaElementAudioSourceHandler(); | 45 ~MediaElementAudioSourceHandler() override; |
46 | 46 |
47 HTMLMediaElement* mediaElement() { return m_mediaElement.get(); } | 47 HTMLMediaElement* mediaElement() { return m_mediaElement.get(); } |
48 | 48 |
49 // AudioHandler | 49 // AudioHandler |
50 virtual void dispose() override; | 50 void dispose() override; |
51 virtual void process(size_t framesToProcess) override; | 51 void process(size_t framesToProcess) override; |
52 | 52 |
53 // Helpers for AudioSourceProviderClient implementation of | 53 // Helpers for AudioSourceProviderClient implementation of |
54 // MediaElementAudioSourceNode. | 54 // MediaElementAudioSourceNode. |
55 void setFormat(size_t numberOfChannels, float sampleRate); | 55 void setFormat(size_t numberOfChannels, float sampleRate); |
56 void onCurrentSrcChanged(const KURL& currentSrc); | 56 void onCurrentSrcChanged(const KURL& currentSrc); |
57 void lock(); | 57 void lock(); |
58 void unlock(); | 58 void unlock(); |
59 | 59 |
60 private: | 60 private: |
61 MediaElementAudioSourceHandler(AudioNode&, HTMLMediaElement&); | 61 MediaElementAudioSourceHandler(AudioNode&, HTMLMediaElement&); |
62 // As an audio source, we will never propagate silence. | 62 // As an audio source, we will never propagate silence. |
63 virtual bool propagatesSilence() const override { return false; } | 63 bool propagatesSilence() const override { return false; } |
64 | 64 |
65 // Must be called only on the audio thread. | 65 // Must be called only on the audio thread. |
66 bool passesCORSAccessCheck(); | 66 bool passesCORSAccessCheck(); |
67 | 67 |
68 // Must be called only on the main thread. | 68 // Must be called only on the main thread. |
69 bool passesCurrentSrcCORSAccessCheck(const KURL& currentSrc); | 69 bool passesCurrentSrcCORSAccessCheck(const KURL& currentSrc); |
70 | 70 |
71 // Print warning if CORS restrictions cause MediaElementAudioSource to outpu
t zeroes. | 71 // Print warning if CORS restrictions cause MediaElementAudioSource to outpu
t zeroes. |
72 void printCORSMessage(const String& message); | 72 void printCORSMessage(const String& message); |
73 | 73 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 private: | 117 private: |
118 MediaElementAudioSourceNode(AudioContext&, HTMLMediaElement&); | 118 MediaElementAudioSourceNode(AudioContext&, HTMLMediaElement&); |
119 }; | 119 }; |
120 | 120 |
121 } // namespace blink | 121 } // namespace blink |
122 | 122 |
123 #endif // ENABLE(WEB_AUDIO) | 123 #endif // ENABLE(WEB_AUDIO) |
124 | 124 |
125 #endif // MediaElementAudioSourceNode_h | 125 #endif // MediaElementAudioSourceNode_h |
OLD | NEW |