| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 false)), | 70 false)), |
| 71 render_bus_(AudioBus::Create(number_of_output_channels, | 71 render_bus_(AudioBus::Create(number_of_output_channels, |
| 72 AudioUtilities::kRenderQuantumFrames)), | 72 AudioUtilities::kRenderQuantumFrames)), |
| 73 fifo_(WTF::WrapUnique( | 73 fifo_(WTF::WrapUnique( |
| 74 new PushPullFIFO(number_of_output_channels, kFIFOSize))), | 74 new PushPullFIFO(number_of_output_channels, kFIFOSize))), |
| 75 frames_elapsed_(0) { | 75 frames_elapsed_(0) { |
| 76 // Create WebAudioDevice. blink::WebAudioDevice is designed to support the | 76 // Create WebAudioDevice. blink::WebAudioDevice is designed to support the |
| 77 // local input (e.g. loopback from OS audio system), but Chromium's media | 77 // local input (e.g. loopback from OS audio system), but Chromium's media |
| 78 // renderer does not support it currently. Thus, we use zero for the number | 78 // renderer does not support it currently. Thus, we use zero for the number |
| 79 // of input channels. | 79 // of input channels. |
| 80 web_audio_device_ = Platform::Current()->CreateAudioDevice( | 80 web_audio_device_ = WTF::WrapUnique(Platform::Current()->CreateAudioDevice( |
| 81 0, number_of_output_channels, latency_hint, this, String(), | 81 0, number_of_output_channels, latency_hint, this, String(), |
| 82 std::move(security_origin)); | 82 std::move(security_origin))); |
| 83 DCHECK(web_audio_device_); | 83 DCHECK(web_audio_device_); |
| 84 | 84 |
| 85 callback_buffer_size_ = web_audio_device_->FramesPerBuffer(); | 85 callback_buffer_size_ = web_audio_device_->FramesPerBuffer(); |
| 86 if (!CheckBufferSize()) { | 86 if (!CheckBufferSize()) { |
| 87 NOTREACHED(); | 87 NOTREACHED(); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 AudioDestination::~AudioDestination() { | 91 AudioDestination::~AudioDestination() { |
| 92 Stop(); | 92 Stop(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 callback_buffer_size_histogram.Sample(callback_buffer_size_); | 198 callback_buffer_size_histogram.Sample(callback_buffer_size_); |
| 199 | 199 |
| 200 // Check if the requested buffer size is too large. | 200 // Check if the requested buffer size is too large. |
| 201 bool is_buffer_size_valid = | 201 bool is_buffer_size_valid = |
| 202 callback_buffer_size_ + AudioUtilities::kRenderQuantumFrames <= kFIFOSize; | 202 callback_buffer_size_ + AudioUtilities::kRenderQuantumFrames <= kFIFOSize; |
| 203 DCHECK(is_buffer_size_valid); | 203 DCHECK(is_buffer_size_valid); |
| 204 return is_buffer_size_valid; | 204 return is_buffer_size_valid; |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |