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

Side by Side Diff: Source/modules/webaudio/PannerNode.cpp

Issue 1214463003: Split "Online" and "Offline" AudioContext processing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (!source) { 100 if (!source) {
101 destination->zero(); 101 destination->zero();
102 return; 102 return;
103 } 103 }
104 104
105 // The audio thread can't block on this lock, so we call tryLock() instead. 105 // The audio thread can't block on this lock, so we call tryLock() instead.
106 MutexTryLocker tryLocker(m_processLock); 106 MutexTryLocker tryLocker(m_processLock);
107 MutexTryLocker tryListenerLocker(listener()->listenerLock()); 107 MutexTryLocker tryListenerLocker(listener()->listenerLock());
108 108
109 if (tryLocker.locked() && tryListenerLocker.locked()) { 109 if (tryLocker.locked() && tryListenerLocker.locked()) {
110 // HRTFDatabase should be loaded before proceeding for offline audio con text when the panning model is HRTF. 110 // HRTFDatabase should be loaded before proceeding when the panning mode l is HRTF.
111 if (m_panningModel == Panner::PanningModelHRTF && !listener()->isHRTFDat abaseLoaded()) { 111 if (m_panningModel == Panner::PanningModelHRTF && !listener()->isHRTFDat abaseLoaded()) {
112 if (context()->isOfflineContext()) { 112 if (context()->hasRealtimeConstraint()) {
113 listener()->waitForHRTFDatabaseLoaderThreadCompletion(); 113 // Some AudioContexts cannot block on the HRTFDatabase loader.
114 } else {
115 destination->zero(); 114 destination->zero();
116 return; 115 return;
117 } 116 }
117
118 listener()->waitForHRTFDatabaseLoaderThreadCompletion();
118 } 119 }
119 120
120 // Apply the panning effect. 121 // Apply the panning effect.
121 double azimuth; 122 double azimuth;
122 double elevation; 123 double elevation;
123 azimuthElevation(&azimuth, &elevation); 124 azimuthElevation(&azimuth, &elevation);
124 125
125 m_panner->pan(azimuth, elevation, source, destination, framesToProcess); 126 m_panner->pan(azimuth, elevation, source, destination, framesToProcess);
126 127
127 // Get the distance and cone gain. 128 // Get the distance and cone gain.
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 } 687 }
687 688
688 void PannerNode::setConeOuterGain(double gain) 689 void PannerNode::setConeOuterGain(double gain)
689 { 690 {
690 pannerHandler().setConeOuterGain(gain); 691 pannerHandler().setConeOuterGain(gain);
691 } 692 }
692 693
693 } // namespace blink 694 } // namespace blink
694 695
695 #endif // ENABLE(WEB_AUDIO) 696 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698