| 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 "content/renderer/media/webaudiosourceprovider_impl.h" | 5 #include "content/renderer/media/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 30 matching lines...) Expand all Loading... |
| 41 private: | 41 private: |
| 42 base::Lock& lock_; | 42 base::Lock& lock_; |
| 43 const bool acquired_; | 43 const bool acquired_; |
| 44 DISALLOW_COPY_AND_ASSIGN(AutoTryLock); | 44 DISALLOW_COPY_AND_ASSIGN(AutoTryLock); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 WebAudioSourceProviderImpl::WebAudioSourceProviderImpl( | 49 WebAudioSourceProviderImpl::WebAudioSourceProviderImpl( |
| 50 const scoped_refptr<media::AudioRendererSink>& sink) | 50 const scoped_refptr<media::AudioRendererSink>& sink) |
| 51 : weak_this_(this), | 51 : channels_(0), |
| 52 channels_(0), | |
| 53 sample_rate_(0), | 52 sample_rate_(0), |
| 54 volume_(1.0), | 53 volume_(1.0), |
| 55 state_(kStopped), | 54 state_(kStopped), |
| 56 renderer_(NULL), | 55 renderer_(NULL), |
| 57 client_(NULL), | 56 client_(NULL), |
| 58 sink_(sink) { | 57 sink_(sink), |
| 59 } | 58 weak_this_(this) {} |
| 60 | 59 |
| 61 WebAudioSourceProviderImpl::~WebAudioSourceProviderImpl() { | 60 WebAudioSourceProviderImpl::~WebAudioSourceProviderImpl() { |
| 62 } | 61 } |
| 63 | 62 |
| 64 void WebAudioSourceProviderImpl::setClient( | 63 void WebAudioSourceProviderImpl::setClient( |
| 65 blink::WebAudioSourceProviderClient* client) { | 64 blink::WebAudioSourceProviderClient* client) { |
| 66 base::AutoLock auto_lock(sink_lock_); | 65 base::AutoLock auto_lock(sink_lock_); |
| 67 if (client && client != client_) { | 66 if (client && client != client_) { |
| 68 // Detach the audio renderer from normal playback. | 67 // Detach the audio renderer from normal playback. |
| 69 sink_->Stop(); | 68 sink_->Stop(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 void WebAudioSourceProviderImpl::OnSetFormat() { | 179 void WebAudioSourceProviderImpl::OnSetFormat() { |
| 181 base::AutoLock auto_lock(sink_lock_); | 180 base::AutoLock auto_lock(sink_lock_); |
| 182 if (!client_) | 181 if (!client_) |
| 183 return; | 182 return; |
| 184 | 183 |
| 185 // Inform Blink about the audio stream format. | 184 // Inform Blink about the audio stream format. |
| 186 client_->setFormat(channels_, sample_rate_); | 185 client_->setFormat(channels_, sample_rate_); |
| 187 } | 186 } |
| 188 | 187 |
| 189 } // namespace content | 188 } // namespace content |
| OLD | NEW |