Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioDestination.h

Issue 2590983003: Remove input/source components from AudioDestination (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 24 matching lines...) Expand all
35 #include "public/platform/WebAudioDevice.h" 35 #include "public/platform/WebAudioDevice.h"
36 #include "public/platform/WebVector.h" 36 #include "public/platform/WebVector.h"
37 #include "wtf/Allocator.h" 37 #include "wtf/Allocator.h"
38 #include "wtf/Noncopyable.h" 38 #include "wtf/Noncopyable.h"
39 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
40 #include "wtf/text/WTFString.h" 40 #include "wtf/text/WTFString.h"
41 #include <memory> 41 #include <memory>
42 42
43 namespace blink { 43 namespace blink {
44 44
45 class AudioFIFO;
46 class AudioPullFIFO; 45 class AudioPullFIFO;
47 class SecurityOrigin; 46 class SecurityOrigin;
48 47
49 // An AudioDestination using Chromium's audio system 48 // An AudioDestination using Chromium's audio system
50 49
51 class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback, 50 class PLATFORM_EXPORT AudioDestination : public WebAudioDevice::RenderCallback,
52 public AudioSourceProvider { 51 public AudioSourceProvider {
53 USING_FAST_MALLOC(AudioDestination); 52 USING_FAST_MALLOC(AudioDestination);
54 WTF_MAKE_NONCOPYABLE(AudioDestination); 53 WTF_MAKE_NONCOPYABLE(AudioDestination);
55 54
(...skipping 17 matching lines...) Expand all
73 float sampleRate, 72 float sampleRate,
74 PassRefPtr<SecurityOrigin>); 73 PassRefPtr<SecurityOrigin>);
75 74
76 virtual void start(); 75 virtual void start();
77 virtual void stop(); 76 virtual void stop();
78 bool isPlaying() { return m_isPlaying; } 77 bool isPlaying() { return m_isPlaying; }
79 78
80 float sampleRate() const { return m_sampleRate; } 79 float sampleRate() const { return m_sampleRate; }
81 80
82 // WebAudioDevice::RenderCallback 81 // WebAudioDevice::RenderCallback
83 void render(const WebVector<float*>& sourceData, 82 void render(const WebVector<float*>& audioData,
84 const WebVector<float*>& audioData,
85 size_t numberOfFrames, 83 size_t numberOfFrames,
86 double delay, 84 double delay,
87 double delayTimestamp, 85 double delayTimestamp,
88 size_t priorFramesSkipped) override; 86 size_t priorFramesSkipped) override;
89 87
90 // AudioSourceProvider 88 // AudioSourceProvider
91 void provideInput(AudioBus*, size_t framesToProcess) override; 89 void provideInput(AudioBus*, size_t framesToProcess) override;
92 90
93 static float hardwareSampleRate(); 91 static float hardwareSampleRate();
94 92
95 // maxChannelCount() returns the total number of output channels of the audio 93 // maxChannelCount() returns the total number of output channels of the audio
96 // hardware. A value of 0 indicates that the number of channels cannot be 94 // hardware. A value of 0 indicates that the number of channels cannot be
97 // configured and that only stereo (2-channel) destinations can be created. 95 // configured and that only stereo (2-channel) destinations can be created.
98 // The numberOfOutputChannels parameter of AudioDestination::create() is 96 // The numberOfOutputChannels parameter of AudioDestination::create() is
99 // allowed to be a value: 1 <= numberOfOutputChannels <= maxChannelCount(), 97 // allowed to be a value: 1 <= numberOfOutputChannels <= maxChannelCount(),
100 // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2. 98 // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2.
101 static unsigned long maxChannelCount(); 99 static unsigned long maxChannelCount();
102 100
103 private: 101 private:
104 AudioIOCallback& m_callback; 102 AudioIOCallback& m_callback;
105 unsigned m_numberOfOutputChannels; 103 unsigned m_numberOfOutputChannels;
106 RefPtr<AudioBus> m_inputBus;
107 RefPtr<AudioBus> m_renderBus; 104 RefPtr<AudioBus> m_renderBus;
108 float m_sampleRate; 105 float m_sampleRate;
109 bool m_isPlaying; 106 bool m_isPlaying;
110 std::unique_ptr<WebAudioDevice> m_audioDevice; 107 std::unique_ptr<WebAudioDevice> m_audioDevice;
111 size_t m_callbackBufferSize; 108 size_t m_callbackBufferSize;
112 109
113 std::unique_ptr<AudioFIFO> m_inputFifo;
114 std::unique_ptr<AudioPullFIFO> m_fifo; 110 std::unique_ptr<AudioPullFIFO> m_fifo;
115 111
116 size_t m_framesElapsed; 112 size_t m_framesElapsed;
117 AudioIOPosition m_outputPosition; 113 AudioIOPosition m_outputPosition;
118 base::TimeTicks m_outputPositionReceivedTimestamp; 114 base::TimeTicks m_outputPositionReceivedTimestamp;
119 }; 115 };
120 116
121 } // namespace blink 117 } // namespace blink
122 118
123 #endif // AudioDestination_h 119 #endif // AudioDestination_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698