OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_audiosourceprovider.h" | 5 #include "content/renderer/media/render_audiosourceprovider.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide
rClient.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide
rClient.h" |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 void RenderAudioSourceProvider::GetVolume(double* volume) { | 68 void RenderAudioSourceProvider::GetVolume(double* volume) { |
69 if (!client_) | 69 if (!client_) |
70 default_sink_->GetVolume(volume); | 70 default_sink_->GetVolume(volume); |
71 else if (volume) | 71 else if (volume) |
72 *volume = volume_; | 72 *volume = volume_; |
73 } | 73 } |
74 | 74 |
75 void RenderAudioSourceProvider::Initialize( | 75 void RenderAudioSourceProvider::Initialize( |
76 const AudioParameters& params, RenderCallback* renderer) { | 76 const media::AudioParameters& params, RenderCallback* renderer) { |
77 base::AutoLock auto_lock(sink_lock_); | 77 base::AutoLock auto_lock(sink_lock_); |
78 CHECK(!is_initialized_); | 78 CHECK(!is_initialized_); |
79 renderer_ = renderer; | 79 renderer_ = renderer; |
80 | 80 |
81 default_sink_->Initialize(params, renderer); | 81 default_sink_->Initialize(params, renderer); |
82 | 82 |
83 // Keep track of the format in case the client hasn't yet been set. | 83 // Keep track of the format in case the client hasn't yet been set. |
84 channels_ = params.channels(); | 84 channels_ = params.channels(); |
85 sample_rate_ = params.sample_rate(); | 85 sample_rate_ = params.sample_rate(); |
86 | 86 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 // TODO(crogers): figure out if we should volume scale here or in common | 133 // TODO(crogers): figure out if we should volume scale here or in common |
134 // WebAudio code. In any case we need to take care of volume. | 134 // WebAudio code. In any case we need to take care of volume. |
135 renderer_->Render(v, number_of_frames, 0); | 135 renderer_->Render(v, number_of_frames, 0); |
136 } else { | 136 } else { |
137 // Provide silence if the source is not running. | 137 // Provide silence if the source is not running. |
138 for (size_t i = 0; i < audio_data.size(); ++i) | 138 for (size_t i = 0; i < audio_data.size(); ++i) |
139 memset(audio_data[i], 0, sizeof(float) * number_of_frames); | 139 memset(audio_data[i], 0, sizeof(float) * number_of_frames); |
140 } | 140 } |
141 } | 141 } |
OLD | NEW |