OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/blink/webaudiosourceprovider_impl.h" | 5 #include "media/blink/webaudiosourceprovider_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (!auto_try_lock.locked() || state_ != kPlaying) { | 107 if (!auto_try_lock.locked() || state_ != kPlaying) { |
108 // Provide silence if we failed to acquire the lock or the source is not | 108 // Provide silence if we failed to acquire the lock or the source is not |
109 // running. | 109 // running. |
110 bus_wrapper_->Zero(); | 110 bus_wrapper_->Zero(); |
111 return; | 111 return; |
112 } | 112 } |
113 | 113 |
114 DCHECK(renderer_); | 114 DCHECK(renderer_); |
115 DCHECK(client_); | 115 DCHECK(client_); |
116 DCHECK_EQ(channels_, bus_wrapper_->channels()); | 116 DCHECK_EQ(channels_, bus_wrapper_->channels()); |
117 const int frames = renderer_->Render(bus_wrapper_.get(), 0); | 117 const int frames = renderer_->Render(bus_wrapper_.get(), 0, 0); |
118 if (frames < static_cast<int>(number_of_frames)) { | 118 if (frames < static_cast<int>(number_of_frames)) { |
119 bus_wrapper_->ZeroFramesPartial( | 119 bus_wrapper_->ZeroFramesPartial( |
120 frames, | 120 frames, |
121 static_cast<int>(number_of_frames - frames)); | 121 static_cast<int>(number_of_frames - frames)); |
122 } | 122 } |
123 | 123 |
124 bus_wrapper_->Scale(volume_); | 124 bus_wrapper_->Scale(volume_); |
125 } | 125 } |
126 | 126 |
127 void WebAudioSourceProviderImpl::Start() { | 127 void WebAudioSourceProviderImpl::Start() { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void WebAudioSourceProviderImpl::OnSetFormat() { | 189 void WebAudioSourceProviderImpl::OnSetFormat() { |
190 base::AutoLock auto_lock(sink_lock_); | 190 base::AutoLock auto_lock(sink_lock_); |
191 if (!client_) | 191 if (!client_) |
192 return; | 192 return; |
193 | 193 |
194 // Inform Blink about the audio stream format. | 194 // Inform Blink about the audio stream format. |
195 client_->setFormat(channels_, sample_rate_); | 195 client_->setFormat(channels_, sample_rate_); |
196 } | 196 } |
197 | 197 |
198 } // namespace media | 198 } // namespace media |
OLD | NEW |