OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 23 matching lines...) Expand all Loading... |
34 #include "wtf/OwnPtr.h" | 34 #include "wtf/OwnPtr.h" |
35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
36 #include "wtf/Threading.h" | 36 #include "wtf/Threading.h" |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 class AudioContext; | 40 class AudioContext; |
41 | 41 |
42 class MediaStreamAudioSourceNode : public AudioSourceNode, public AudioSourcePro
viderClient { | 42 class MediaStreamAudioSourceNode : public AudioSourceNode, public AudioSourcePro
viderClient { |
43 public: | 43 public: |
44 static PassRefPtr<MediaStreamAudioSourceNode> create(AudioContext*, MediaStr
eam*, AudioSourceProvider*); | 44 static PassRefPtr<MediaStreamAudioSourceNode> create(AudioContext*, MediaStr
eam*, MediaStreamTrack*, AudioSourceProvider*); |
45 | 45 |
46 virtual ~MediaStreamAudioSourceNode(); | 46 virtual ~MediaStreamAudioSourceNode(); |
47 | 47 |
48 MediaStream* mediaStream() { return m_mediaStream.get(); } | 48 MediaStream* mediaStream() { return m_mediaStream.get(); } |
49 | 49 |
50 // AudioNode | 50 // AudioNode |
51 virtual void process(size_t framesToProcess); | 51 virtual void process(size_t framesToProcess); |
52 virtual void reset(); | 52 virtual void reset(); |
53 | 53 |
54 // AudioSourceProviderClient | 54 // AudioSourceProviderClient |
55 virtual void setFormat(size_t numberOfChannels, float sampleRate); | 55 virtual void setFormat(size_t numberOfChannels, float sampleRate); |
56 | 56 |
57 AudioSourceProvider* audioSourceProvider() const { return m_audioSourceProvi
der; } | 57 AudioSourceProvider* audioSourceProvider() const { return m_audioSourceProvi
der; } |
58 | 58 |
59 private: | 59 private: |
60 MediaStreamAudioSourceNode(AudioContext*, MediaStream*, AudioSourceProvider*
); | 60 MediaStreamAudioSourceNode(AudioContext*, MediaStream*, MediaStreamTrack*, A
udioSourceProvider*); |
61 | 61 |
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 virtual bool propagatesSilence() const OVERRIDE { return false; } |
64 | 64 |
65 RefPtr<MediaStream> m_mediaStream; | 65 RefPtr<MediaStream> m_mediaStream; |
| 66 RefPtr<MediaStreamTrack> m_audioTrack; |
66 AudioSourceProvider* m_audioSourceProvider; | 67 AudioSourceProvider* m_audioSourceProvider; |
67 | 68 |
68 Mutex m_processLock; | 69 Mutex m_processLock; |
69 | 70 |
70 unsigned m_sourceNumberOfChannels; | 71 unsigned m_sourceNumberOfChannels; |
71 }; | 72 }; |
72 | 73 |
73 } // namespace WebCore | 74 } // namespace WebCore |
74 | 75 |
75 #endif // ENABLE(WEB_AUDIO) | 76 #endif // ENABLE(WEB_AUDIO) |
76 | 77 |
77 #endif // MediaStreamAudioSourceNode_h | 78 #endif // MediaStreamAudioSourceNode_h |
OLD | NEW |