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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioDestinationNode.h

Issue 2501863003: Support for AudioContextOptions latencyHint. (Closed)
Patch Set: Updates based on reviewer comments. Created 4 years 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 * 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 21 matching lines...) Expand all
32 #include "platform/audio/AudioIOCallback.h" 32 #include "platform/audio/AudioIOCallback.h"
33 #include "platform/audio/AudioSourceProvider.h" 33 #include "platform/audio/AudioSourceProvider.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class AudioBus; 37 class AudioBus;
38 class BaseAudioContext; 38 class BaseAudioContext;
39 39
40 class AudioDestinationHandler : public AudioHandler, public AudioIOCallback { 40 class AudioDestinationHandler : public AudioHandler, public AudioIOCallback {
41 public: 41 public:
42 AudioDestinationHandler(AudioNode&, float sampleRate); 42 AudioDestinationHandler(AudioNode&);
43 ~AudioDestinationHandler() override; 43 ~AudioDestinationHandler() override;
44 44
45 // AudioHandler 45 // AudioHandler
46 void process(size_t) final { 46 void process(size_t) final {
47 } // we're pulled by hardware so this is never called 47 } // we're pulled by hardware so this is never called
48 48
49 // The audio hardware calls render() to get the next render quantum of audio 49 // The audio hardware calls render() to get the next render quantum of audio
50 // into destinationBus. It will optionally give us local/live audio input in 50 // into destinationBus. It will optionally give us local/live audio input in
51 // sourceBus (if it's not 0). 51 // sourceBus (if it's not 0).
52 void render(AudioBus* sourceBus, 52 void render(AudioBus* sourceBus,
53 AudioBus* destinationBus, 53 AudioBus* destinationBus,
54 size_t numberOfFrames) final; 54 size_t numberOfFrames) final;
55 55
56 size_t currentSampleFrame() const { 56 size_t currentSampleFrame() const {
57 return acquireLoad(&m_currentSampleFrame); 57 return acquireLoad(&m_currentSampleFrame);
58 } 58 }
59 double currentTime() const { 59 double currentTime() const {
60 return currentSampleFrame() / static_cast<double>(sampleRate()); 60 return currentSampleFrame() / static_cast<double>(sampleRate());
o1ka 2016/12/02 12:02:13 What behavior we prefer in case sampleRate() is ze
Raymond Toy 2016/12/02 16:57:45 I believe this is safe, and infinity is ok. This
61 } 61 }
62 62
63 virtual unsigned long maxChannelCount() const { return 0; } 63 virtual unsigned long maxChannelCount() const { return 0; }
64 64
65 virtual void startRendering() = 0; 65 virtual void startRendering() = 0;
66 virtual void stopRendering() = 0; 66 virtual void stopRendering() = 0;
67 67
68 virtual double sampleRate() const = 0;
69 virtual int framesPerBuffer() const = 0;
hongchan 2016/12/02 17:40:12 What does this mean? Isn't it same with the 'rende
Andrew MacPherson 2016/12/05 14:12:53 This is the buffer size in frames used by the unde
70
68 protected: 71 protected:
69 // LocalAudioInputProvider allows us to expose an AudioSourceProvider for 72 // LocalAudioInputProvider allows us to expose an AudioSourceProvider for
70 // local/live audio input. If there is local/live audio input, we call set() 73 // local/live audio input. If there is local/live audio input, we call set()
71 // with the audio input data every render quantum. 74 // with the audio input data every render quantum.
72 class LocalAudioInputProvider final : public AudioSourceProvider { 75 class LocalAudioInputProvider final : public AudioSourceProvider {
73 public: 76 public:
74 LocalAudioInputProvider() 77 LocalAudioInputProvider()
75 : m_sourceBus(AudioBus::create( 78 : m_sourceBus(AudioBus::create(
76 2, 79 2,
77 AudioUtilities::kRenderQuantumFrames)) // FIXME: handle 80 AudioUtilities::kRenderQuantumFrames)) // FIXME: handle
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 115
113 unsigned long maxChannelCount() const; 116 unsigned long maxChannelCount() const;
114 117
115 protected: 118 protected:
116 AudioDestinationNode(BaseAudioContext&); 119 AudioDestinationNode(BaseAudioContext&);
117 }; 120 };
118 121
119 } // namespace blink 122 } // namespace blink
120 123
121 #endif // AudioDestinationNode_h 124 #endif // AudioDestinationNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698