| OLD | NEW |
| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // When a source node has no more processing to do (has finished playing), | 242 // When a source node has no more processing to do (has finished playing), |
| 243 // this method tells the context to release the corresponding node. | 243 // this method tells the context to release the corresponding node. |
| 244 void notifySourceNodeFinishedProcessing(AudioHandler*); | 244 void notifySourceNodeFinishedProcessing(AudioHandler*); |
| 245 | 245 |
| 246 // Called at the start of each render quantum. | 246 // Called at the start of each render quantum. |
| 247 void handlePreRenderTasks(const AudioIOPosition& outputPosition); | 247 void handlePreRenderTasks(const AudioIOPosition& outputPosition); |
| 248 | 248 |
| 249 // Called at the end of each render quantum. | 249 // Called at the end of each render quantum. |
| 250 void handlePostRenderTasks(); | 250 void handlePostRenderTasks(); |
| 251 | 251 |
| 252 // Called periodically at the end of each render quantum to release finished | 252 // Called periodically at the end of each render quantum to release |
| 253 // source nodes. | 253 // finished source nodes. Updates m_finishedSourceNodes with nodes |
| 254 void releaseFinishedSourceNodes(); | 254 // to be deleted. Returns true if any node needs deletion. Must be |
| 255 // run from the audio thread. |
| 256 bool releaseFinishedSourceNodes(); |
| 257 |
| 258 // Actually remove the nodes noted for deletion by |
| 259 // releaseFinishedSourceNodes. Must be run from the main thread, |
| 260 // and must not be run with the context lock. |
| 261 void removeFinishedSourceNodes(); |
| 255 | 262 |
| 256 // Keeps track of the number of connections made. | 263 // Keeps track of the number of connections made. |
| 257 void incrementConnectionCount() { | 264 void incrementConnectionCount() { |
| 258 DCHECK(isMainThread()); | 265 DCHECK(isMainThread()); |
| 259 m_connectionCount++; | 266 m_connectionCount++; |
| 260 } | 267 } |
| 261 | 268 |
| 262 unsigned connectionCount() const { return m_connectionCount; } | 269 unsigned connectionCount() const { return m_connectionCount; } |
| 263 | 270 |
| 264 DeferredTaskHandler& deferredTaskHandler() const { | 271 DeferredTaskHandler& deferredTaskHandler() const { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 AutoplayStatusCount | 379 AutoplayStatusCount |
| 373 }; | 380 }; |
| 374 | 381 |
| 375 bool m_isCleared; | 382 bool m_isCleared; |
| 376 void clear(); | 383 void clear(); |
| 377 | 384 |
| 378 // When the context goes away, there might still be some sources which | 385 // When the context goes away, there might still be some sources which |
| 379 // haven't finished playing. Make sure to release them here. | 386 // haven't finished playing. Make sure to release them here. |
| 380 void releaseActiveSourceNodes(); | 387 void releaseActiveSourceNodes(); |
| 381 | 388 |
| 382 void removeFinishedSourceNodes(); | |
| 383 | |
| 384 // Listener for the PannerNodes | 389 // Listener for the PannerNodes |
| 385 Member<AudioListener> m_listener; | 390 Member<AudioListener> m_listener; |
| 386 | 391 |
| 387 // Only accessed in the audio thread. | 392 // Only accessed in the audio thread. |
| 388 // These raw pointers are safe because AudioSourceNodes in | 393 // These raw pointers are safe because AudioSourceNodes in |
| 389 // m_activeSourceNodes own them. | 394 // m_activeSourceNodes own them. |
| 390 Vector<AudioHandler*> m_finishedSourceHandlers; | 395 Vector<AudioHandler*> m_finishedSourceHandlers; |
| 391 | 396 |
| 392 // List of source nodes. This is either accessed when the graph lock is | 397 // List of source nodes. This is either accessed when the graph lock is |
| 393 // held, or on the main thread when the audio thread has finished. | 398 // held, or on the main thread when the audio thread has finished. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 // It is somewhat arbitrary and could be increased if necessary. | 461 // It is somewhat arbitrary and could be increased if necessary. |
| 457 enum { MaxNumberOfChannels = 32 }; | 462 enum { MaxNumberOfChannels = 32 }; |
| 458 | 463 |
| 459 Optional<AutoplayStatus> m_autoplayStatus; | 464 Optional<AutoplayStatus> m_autoplayStatus; |
| 460 AudioIOPosition m_outputPosition; | 465 AudioIOPosition m_outputPosition; |
| 461 }; | 466 }; |
| 462 | 467 |
| 463 } // namespace blink | 468 } // namespace blink |
| 464 | 469 |
| 465 #endif // BaseAudioContext_h | 470 #endif // BaseAudioContext_h |
| OLD | NEW |