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

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: review commnets + more tests fixes + 'Packet' structure Created 4 years, 6 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Port-specific device identification information for live/local input stre ams can be passed in the inputDeviceId. 57 // Port-specific device identification information for live/local input stre ams can be passed in the inputDeviceId.
58 static PassOwnPtr<AudioDestination> create(AudioIOCallback&, const String& i nputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, f loat sampleRate, const PassRefPtr<SecurityOrigin>&); 58 static PassOwnPtr<AudioDestination> create(AudioIOCallback&, const String& i nputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, f loat sampleRate, const PassRefPtr<SecurityOrigin>&);
59 59
60 virtual void start(); 60 virtual void start();
61 virtual void stop(); 61 virtual void stop();
62 bool isPlaying() { return m_isPlaying; } 62 bool isPlaying() { return m_isPlaying; }
63 63
64 float sampleRate() const { return m_sampleRate; } 64 float sampleRate() const { return m_sampleRate; }
65 65
66 // WebAudioDevice::RenderCallback 66 // WebAudioDevice::RenderCallback
67 void render(const WebVector<float*>& sourceData, const WebVector<float*>& au dioData, size_t numberOfFrames) override; 67 void render(const WebVector<float*>& sourceData, const WebVector<float*>& au dioData, size_t numberOfFrames, const WebAudioTimestamp&) override;
68 68
69 // AudioSourceProvider 69 // AudioSourceProvider
70 void provideInput(AudioBus*, size_t framesToProcess) override; 70 void provideInput(AudioBus*, size_t framesToProcess) override;
71 71
72 static float hardwareSampleRate(); 72 static float hardwareSampleRate();
73 73
74 // maxChannelCount() returns the total number of output channels of the audi o hardware. 74 // maxChannelCount() returns the total number of output channels of the audi o hardware.
75 // A value of 0 indicates that the number of channels cannot be configured a nd 75 // A value of 0 indicates that the number of channels cannot be configured a nd
76 // that only stereo (2-channel) destinations can be created. 76 // that only stereo (2-channel) destinations can be created.
77 // The numberOfOutputChannels parameter of AudioDestination::create() is all owed to 77 // The numberOfOutputChannels parameter of AudioDestination::create() is all owed to
78 // be a value: 1 <= numberOfOutputChannels <= maxChannelCount(), 78 // be a value: 1 <= numberOfOutputChannels <= maxChannelCount(),
79 // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2. 79 // or if maxChannelCount() equals 0, then numberOfOutputChannels must be 2.
80 static unsigned long maxChannelCount(); 80 static unsigned long maxChannelCount();
81 81
82 private: 82 private:
83 AudioIOCallback& m_callback; 83 AudioIOCallback& m_callback;
84 unsigned m_numberOfOutputChannels; 84 unsigned m_numberOfOutputChannels;
85 RefPtr<AudioBus> m_inputBus; 85 RefPtr<AudioBus> m_inputBus;
86 RefPtr<AudioBus> m_renderBus; 86 RefPtr<AudioBus> m_renderBus;
87 float m_sampleRate; 87 float m_sampleRate;
88 bool m_isPlaying; 88 bool m_isPlaying;
89 OwnPtr<WebAudioDevice> m_audioDevice; 89 OwnPtr<WebAudioDevice> m_audioDevice;
90 size_t m_callbackBufferSize; 90 size_t m_callbackBufferSize;
91 91
92 OwnPtr<AudioFIFO> m_inputFifo; 92 OwnPtr<AudioFIFO> m_inputFifo;
93 OwnPtr<AudioPullFIFO> m_fifo; 93 OwnPtr<AudioPullFIFO> m_fifo;
94 WebAudioTimestamp m_outputTimestamp;
94 }; 95 };
95 96
96 } // namespace blink 97 } // namespace blink
97 98
98 #endif // AudioDestination_h 99 #endif // AudioDestination_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698