| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 15 matching lines...) Expand all Loading... |
| 26 #include "modules/webaudio/OfflineAudioContext.h" | 26 #include "modules/webaudio/OfflineAudioContext.h" |
| 27 #include "bindings/core/v8/ExceptionMessages.h" | 27 #include "bindings/core/v8/ExceptionMessages.h" |
| 28 #include "bindings/core/v8/ExceptionState.h" | 28 #include "bindings/core/v8/ExceptionState.h" |
| 29 #include "core/dom/DOMException.h" | 29 #include "core/dom/DOMException.h" |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
| 32 #include "core/dom/ExecutionContext.h" | 32 #include "core/dom/ExecutionContext.h" |
| 33 #include "modules/webaudio/AudioListener.h" | 33 #include "modules/webaudio/AudioListener.h" |
| 34 #include "modules/webaudio/DeferredTaskHandler.h" | 34 #include "modules/webaudio/DeferredTaskHandler.h" |
| 35 #include "modules/webaudio/OfflineAudioCompletionEvent.h" | 35 #include "modules/webaudio/OfflineAudioCompletionEvent.h" |
| 36 #include "modules/webaudio/OfflineAudioContextOptions.h" |
| 36 #include "modules/webaudio/OfflineAudioDestinationNode.h" | 37 #include "modules/webaudio/OfflineAudioDestinationNode.h" |
| 37 #include "platform/bindings/ScriptState.h" | 38 #include "platform/bindings/ScriptState.h" |
| 38 | 39 |
| 39 #include "platform/CrossThreadFunctional.h" | 40 #include "platform/CrossThreadFunctional.h" |
| 40 #include "platform/Histogram.h" | 41 #include "platform/Histogram.h" |
| 41 #include "platform/audio/AudioUtilities.h" | 42 #include "platform/audio/AudioUtilities.h" |
| 42 #include "public/platform/Platform.h" | 43 #include "public/platform/Platform.h" |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 CustomCountHistogram, offline_context_sample_rate_histogram, | 122 CustomCountHistogram, offline_context_sample_rate_histogram, |
| 122 ("WebAudio.OfflineAudioContext.SampleRate384kHz", 3000, 384000, 50)); | 123 ("WebAudio.OfflineAudioContext.SampleRate384kHz", 3000, 384000, 50)); |
| 123 | 124 |
| 124 offline_context_channel_count_histogram.Sample(number_of_channels); | 125 offline_context_channel_count_histogram.Sample(number_of_channels); |
| 125 offline_context_length_histogram.Count(number_of_frames); | 126 offline_context_length_histogram.Count(number_of_frames); |
| 126 offline_context_sample_rate_histogram.Count(sample_rate); | 127 offline_context_sample_rate_histogram.Count(sample_rate); |
| 127 | 128 |
| 128 return audio_context; | 129 return audio_context; |
| 129 } | 130 } |
| 130 | 131 |
| 132 OfflineAudioContext* OfflineAudioContext::Create( |
| 133 ExecutionContext* context, |
| 134 const OfflineAudioContextOptions& options, |
| 135 ExceptionState& exception_state) { |
| 136 OfflineAudioContext* offline_context = |
| 137 Create(context, options.numberOfChannels(), options.length(), |
| 138 options.sampleRate(), exception_state); |
| 139 |
| 140 return offline_context; |
| 141 } |
| 142 |
| 131 OfflineAudioContext::OfflineAudioContext(Document* document, | 143 OfflineAudioContext::OfflineAudioContext(Document* document, |
| 132 unsigned number_of_channels, | 144 unsigned number_of_channels, |
| 133 size_t number_of_frames, | 145 size_t number_of_frames, |
| 134 float sample_rate, | 146 float sample_rate, |
| 135 ExceptionState& exception_state) | 147 ExceptionState& exception_state) |
| 136 : BaseAudioContext(document, | 148 : BaseAudioContext(document, |
| 137 number_of_channels, | 149 number_of_channels, |
| 138 number_of_frames, | 150 number_of_frames, |
| 139 sample_rate), | 151 sample_rate), |
| 140 is_rendering_started_(false), | 152 is_rendering_started_(false), |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 461 |
| 450 // Note that the GraphLock is required before this check. Since this needs | 462 // Note that the GraphLock is required before this check. Since this needs |
| 451 // to run on the audio thread, OfflineGraphAutoLocker must be used. | 463 // to run on the audio thread, OfflineGraphAutoLocker must be used. |
| 452 if (scheduled_suspends_.Contains(CurrentSampleFrame())) | 464 if (scheduled_suspends_.Contains(CurrentSampleFrame())) |
| 453 return true; | 465 return true; |
| 454 | 466 |
| 455 return false; | 467 return false; |
| 456 } | 468 } |
| 457 | 469 |
| 458 } // namespace blink | 470 } // namespace blink |
| OLD | NEW |