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

Side by Side Diff: Source/modules/webaudio/AudioContext.h

Issue 773273002: Update the current frame count in a safe place (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Modify test to allow 1 block delay. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/webaudio/scriptprocessornode.html ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 virtual void trace(Visitor*) override; 99 virtual void trace(Visitor*) override;
100 100
101 bool isInitialized() const { return m_isInitialized; } 101 bool isInitialized() const { return m_isInitialized; }
102 bool isOfflineContext() { return m_isOfflineContext; } 102 bool isOfflineContext() { return m_isOfflineContext; }
103 103
104 // Document notification 104 // Document notification
105 virtual void stop() override final; 105 virtual void stop() override final;
106 virtual bool hasPendingActivity() const override; 106 virtual bool hasPendingActivity() const override;
107 107
108 AudioDestinationNode* destination() { return m_destinationNode.get(); } 108 AudioDestinationNode* destination() { return m_destinationNode.get(); }
109 // currentSampleFrame() returns the current sample frame. It should only be called from the
110 // audio thread.
109 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF rame(); } 111 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF rame(); }
112 // cachedSampleFrame() is like currentSampleFrame() but must be called from the main thread to
113 // get the sample frame. It might be slightly behind curentSampleFrame() due to locking.
114 size_t cachedSampleFrame() const;
110 double currentTime() const { return m_destinationNode->currentTime(); } 115 double currentTime() const { return m_destinationNode->currentTime(); }
111 float sampleRate() const { return m_destinationNode->sampleRate(); } 116 float sampleRate() const { return m_destinationNode->sampleRate(); }
112 String state() const; 117 String state() const;
113 118
114 AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&); 119 AudioBuffer* createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&);
115 120
116 // Asynchronous audio file data decoding. 121 // Asynchronous audio file data decoding.
117 void decodeAudioData(DOMArrayBuffer*, AudioBufferCallback*, AudioBufferCallb ack*, ExceptionState&); 122 void decodeAudioData(DOMArrayBuffer*, AudioBufferCallback*, AudioBufferCallb ack*, ExceptionState&);
118 123
119 AudioListener* listener() { return m_listener.get(); } 124 AudioListener* listener() { return m_listener.get(); }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 AudioContextState m_contextState; 395 AudioContextState m_contextState;
391 void setContextState(AudioContextState); 396 void setContextState(AudioContextState);
392 397
393 AsyncAudioDecoder m_audioDecoder; 398 AsyncAudioDecoder m_audioDecoder;
394 399
395 // Collection of nodes where the channel count mode has changed. We want the channel count mode 400 // Collection of nodes where the channel count mode has changed. We want the channel count mode
396 // to change in the pre- or post-rendering phase so as not to disturb the ru nning audio thread. 401 // to change in the pre- or post-rendering phase so as not to disturb the ru nning audio thread.
397 GC_PLUGIN_IGNORE("http://crbug.com/404527") 402 GC_PLUGIN_IGNORE("http://crbug.com/404527")
398 HashSet<AudioNode*> m_deferredCountModeChange; 403 HashSet<AudioNode*> m_deferredCountModeChange;
399 404
405 // Follows the destination's currentSampleFrame, but might be slightly behin d due to locking.
406 size_t m_cachedSampleFrame;
407
400 // This is considering 32 is large enough for multiple channels audio. 408 // This is considering 32 is large enough for multiple channels audio.
401 // It is somewhat arbitrary and could be increased if necessary. 409 // It is somewhat arbitrary and could be increased if necessary.
402 enum { MaxNumberOfChannels = 32 }; 410 enum { MaxNumberOfChannels = 32 };
403 }; 411 };
404 412
405 } // namespace blink 413 } // namespace blink
406 414
407 #endif // AudioContext_h 415 #endif // AudioContext_h
OLDNEW
« no previous file with comments | « LayoutTests/webaudio/scriptprocessornode.html ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698