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

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

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from Raymond and miu@ 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 * 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 virtual void start(); 76 virtual void start();
77 virtual void stop(); 77 virtual void stop();
78 bool isPlaying() { return m_isPlaying; } 78 bool isPlaying() { return m_isPlaying; }
79 79
80 float sampleRate() const { return m_sampleRate; } 80 float sampleRate() const { return m_sampleRate; }
81 81
82 // WebAudioDevice::RenderCallback 82 // WebAudioDevice::RenderCallback
83 void render(const WebVector<float*>& sourceData, 83 void render(const WebVector<float*>& sourceData,
84 const WebVector<float*>& audioData, 84 const WebVector<float*>& audioData,
85 size_t numberOfFrames) override; 85 size_t numberOfFrames,
86 double delay, // Output delay in seconds.
miu 2016/11/29 20:51:04 suggestion: Just in case others get confused the w
miu 2016/12/01 05:33:17 Didn't see this addressed in PS10 (and looks like
Mikhail 2016/12/02 11:48:21 Done. Thanks for suggestion!
87 double delayTimestamp, // System timestamp in seconds when
88 // |delay| was obtained.
89 size_t priorFramesSkipped) override;
86 90
87 // AudioSourceProvider 91 // AudioSourceProvider
88 void provideInput(AudioBus*, size_t framesToProcess) override; 92 void provideInput(AudioBus*, size_t framesToProcess) override;
89 93
90 static float hardwareSampleRate(); 94 static float hardwareSampleRate();
91 95
92 // maxChannelCount() returns the total number of output channels of the audio 96 // maxChannelCount() returns the total number of output channels of the audio
93 // hardware. A value of 0 indicates that the number of channels cannot be 97 // hardware. A value of 0 indicates that the number of channels cannot be
94 // configured and that only stereo (2-channel) destinations can be created. 98 // configured and that only stereo (2-channel) destinations can be created.
95 // The numberOfOutputChannels parameter of AudioDestination::create() is 99 // The numberOfOutputChannels parameter of AudioDestination::create() is
96 // allowed to be a value: 1 <= numberOfOutputChannels <= maxChannelCount(), 100 // allowed to be a value: 1 <= numberOfOutputChannels <= maxChannelCount(),
97 // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2. 101 // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2.
98 static unsigned long maxChannelCount(); 102 static unsigned long maxChannelCount();
99 103
100 private: 104 private:
101 AudioIOCallback& m_callback; 105 AudioIOCallback& m_callback;
102 unsigned m_numberOfOutputChannels; 106 unsigned m_numberOfOutputChannels;
103 RefPtr<AudioBus> m_inputBus; 107 RefPtr<AudioBus> m_inputBus;
104 RefPtr<AudioBus> m_renderBus; 108 RefPtr<AudioBus> m_renderBus;
105 float m_sampleRate; 109 float m_sampleRate;
106 bool m_isPlaying; 110 bool m_isPlaying;
107 std::unique_ptr<WebAudioDevice> m_audioDevice; 111 std::unique_ptr<WebAudioDevice> m_audioDevice;
108 size_t m_callbackBufferSize; 112 size_t m_callbackBufferSize;
109 113
110 std::unique_ptr<AudioFIFO> m_inputFifo; 114 std::unique_ptr<AudioFIFO> m_inputFifo;
111 std::unique_ptr<AudioPullFIFO> m_fifo; 115 std::unique_ptr<AudioPullFIFO> m_fifo;
116
117 size_t m_framesElapsed;
118 AudioIOPosition m_outputPosition;
119 base::TimeTicks m_outputPositionReceivedTimestamp;
112 }; 120 };
113 121
114 } // namespace blink 122 } // namespace blink
115 123
116 #endif // AudioDestination_h 124 #endif // AudioDestination_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698