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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 int channels_; | 93 int channels_; |
94 int sample_rate_; | 94 int sample_rate_; |
95 | 95 |
96 CopyAudioCB copy_audio_bus_callback_; | 96 CopyAudioCB copy_audio_bus_callback_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(TeeFilter); | 98 DISALLOW_COPY_AND_ASSIGN(TeeFilter); |
99 }; | 99 }; |
100 | 100 |
101 WebAudioSourceProviderImpl::WebAudioSourceProviderImpl( | 101 WebAudioSourceProviderImpl::WebAudioSourceProviderImpl( |
102 scoped_refptr<SwitchableAudioRendererSink> sink, | 102 scoped_refptr<SwitchableAudioRendererSink> sink, |
103 scoped_refptr<MediaLog> media_log) | 103 MediaLog* media_log) |
104 : volume_(1.0), | 104 : volume_(1.0), |
105 state_(kStopped), | 105 state_(kStopped), |
106 client_(nullptr), | 106 client_(nullptr), |
107 sink_(std::move(sink)), | 107 sink_(std::move(sink)), |
108 tee_filter_(new TeeFilter()), | 108 tee_filter_(new TeeFilter()), |
109 media_log_(std::move(media_log)), | 109 media_log_(media_log), |
110 weak_factory_(this) {} | 110 weak_factory_(this) {} |
111 | 111 |
112 WebAudioSourceProviderImpl::~WebAudioSourceProviderImpl() { | 112 WebAudioSourceProviderImpl::~WebAudioSourceProviderImpl() { |
113 } | 113 } |
114 | 114 |
115 void WebAudioSourceProviderImpl::SetClient( | 115 void WebAudioSourceProviderImpl::SetClient( |
116 blink::WebAudioSourceProviderClient* client) { | 116 blink::WebAudioSourceProviderClient* client) { |
117 // Skip taking the lock if unnecessary. This function is the only setter for | 117 // Skip taking the lock if unnecessary. This function is the only setter for |
118 // |client_| so it's safe to check |client_| outside of the lock. | 118 // |client_| so it's safe to check |client_| outside of the lock. |
119 if (client_ == client) | 119 if (client_ == client) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 return num_rendered_frames; | 333 return num_rendered_frames; |
334 } | 334 } |
335 | 335 |
336 void WebAudioSourceProviderImpl::TeeFilter::OnRenderError() { | 336 void WebAudioSourceProviderImpl::TeeFilter::OnRenderError() { |
337 DCHECK(IsInitialized()); | 337 DCHECK(IsInitialized()); |
338 renderer_->OnRenderError(); | 338 renderer_->OnRenderError(); |
339 } | 339 } |
340 | 340 |
341 } // namespace media | 341 } // namespace media |
OLD | NEW |