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

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

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from 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 * 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // nodes reference all nodes they're connected to. All nodes are ultimately 231 // nodes reference all nodes they're connected to. All nodes are ultimately
232 // connected to the AudioDestinationNode. When the context release a source 232 // connected to the AudioDestinationNode. When the context release a source
233 // node, it will be deactivated from the rendering graph along with all 233 // node, it will be deactivated from the rendering graph along with all
234 // other nodes it is uniquely connected to. 234 // other nodes it is uniquely connected to.
235 void notifySourceNodeStartedProcessing(AudioNode*); 235 void notifySourceNodeStartedProcessing(AudioNode*);
236 // When a source node has no more processing to do (has finished playing), 236 // When a source node has no more processing to do (has finished playing),
237 // this method tells the context to release the corresponding node. 237 // this method tells the context to release the corresponding node.
238 void notifySourceNodeFinishedProcessing(AudioHandler*); 238 void notifySourceNodeFinishedProcessing(AudioHandler*);
239 239
240 // Called at the start of each render quantum. 240 // Called at the start of each render quantum.
241 void handlePreRenderTasks(); 241 void handlePreRenderTasks(const AudioIOPosition& outputPosition);
242 242
243 // Called at the end of each render quantum. 243 // Called at the end of each render quantum.
244 void handlePostRenderTasks(); 244 void handlePostRenderTasks();
245 245
246 // Called periodically at the end of each render quantum to release finished 246 // Called periodically at the end of each render quantum to release finished
247 // source nodes. 247 // source nodes.
248 void releaseFinishedSourceNodes(); 248 void releaseFinishedSourceNodes();
249 249
250 // Keeps track of the number of connections made. 250 // Keeps track of the number of connections made.
251 void incrementConnectionCount() { 251 void incrementConnectionCount() {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 void rejectPendingDecodeAudioDataResolvers(); 340 void rejectPendingDecodeAudioDataResolvers();
341 341
342 // If any, unlock user gesture requirements if a user gesture is being 342 // If any, unlock user gesture requirements if a user gesture is being
343 // processed. 343 // processed.
344 void maybeUnlockUserGesture(); 344 void maybeUnlockUserGesture();
345 345
346 // Returns whether the AudioContext is allowed to start rendering. 346 // Returns whether the AudioContext is allowed to start rendering.
347 bool isAllowedToStart() const; 347 bool isAllowedToStart() const;
348 348
349 AudioIOPosition outputPosition();
350
349 private: 351 private:
350 friend class BaseAudioContextTest; 352 friend class BaseAudioContextTest;
351 353
352 // Do not change the order of this enum, it is used for metrics. 354 // Do not change the order of this enum, it is used for metrics.
353 enum AutoplayStatus { 355 enum AutoplayStatus {
354 // The AudioContext failed to activate because of user gesture requirements. 356 // The AudioContext failed to activate because of user gesture requirements.
355 AutoplayStatusFailed = 0, 357 AutoplayStatusFailed = 0,
356 // Same as AutoplayStatusFailed but start() on a node was called with a user 358 // Same as AutoplayStatusFailed but start() on a node was called with a user
357 // gesture. 359 // gesture.
358 AutoplayStatusFailedWithStart = 1, 360 AutoplayStatusFailedWithStart = 1,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 Member<PeriodicWave> m_periodicWaveSine; 444 Member<PeriodicWave> m_periodicWaveSine;
443 Member<PeriodicWave> m_periodicWaveSquare; 445 Member<PeriodicWave> m_periodicWaveSquare;
444 Member<PeriodicWave> m_periodicWaveSawtooth; 446 Member<PeriodicWave> m_periodicWaveSawtooth;
445 Member<PeriodicWave> m_periodicWaveTriangle; 447 Member<PeriodicWave> m_periodicWaveTriangle;
446 448
447 // This is considering 32 is large enough for multiple channels audio. 449 // This is considering 32 is large enough for multiple channels audio.
448 // It is somewhat arbitrary and could be increased if necessary. 450 // It is somewhat arbitrary and could be increased if necessary.
449 enum { MaxNumberOfChannels = 32 }; 451 enum { MaxNumberOfChannels = 32 };
450 452
451 Optional<AutoplayStatus> m_autoplayStatus; 453 Optional<AutoplayStatus> m_autoplayStatus;
454 AudioIOPosition m_outputPosition;
452 }; 455 };
453 456
454 } // namespace blink 457 } // namespace blink
455 458
456 #endif // BaseAudioContext_h 459 #endif // BaseAudioContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698