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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 is_running_ = true; | 50 is_running_ = true; |
51 } | 51 } |
52 | 52 |
53 void RenderAudioSourceProvider::Pause(bool flush) { | 53 void RenderAudioSourceProvider::Pause(bool flush) { |
54 base::AutoLock auto_lock(sink_lock_); | 54 base::AutoLock auto_lock(sink_lock_); |
55 if (!client_) | 55 if (!client_) |
56 default_sink_->Pause(flush); | 56 default_sink_->Pause(flush); |
57 is_running_ = false; | 57 is_running_ = false; |
58 } | 58 } |
59 | 59 |
| 60 void RenderAudioSourceProvider::SetPlaybackRate(float rate) { |
| 61 base::AutoLock auto_lock(sink_lock_); |
| 62 if (!client_) |
| 63 default_sink_->SetPlaybackRate(rate); |
| 64 } |
| 65 |
60 bool RenderAudioSourceProvider::SetVolume(double volume) { | 66 bool RenderAudioSourceProvider::SetVolume(double volume) { |
61 base::AutoLock auto_lock(sink_lock_); | 67 base::AutoLock auto_lock(sink_lock_); |
62 if (!client_) | 68 if (!client_) |
63 default_sink_->SetVolume(volume); | 69 default_sink_->SetVolume(volume); |
64 volume_ = volume; | 70 volume_ = volume; |
65 return true; | 71 return true; |
66 } | 72 } |
67 | 73 |
68 void RenderAudioSourceProvider::GetVolume(double* volume) { | 74 void RenderAudioSourceProvider::GetVolume(double* volume) { |
69 if (!client_) | 75 if (!client_) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 138 |
133 // TODO(crogers): figure out if we should volume scale here or in common | 139 // 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. | 140 // WebAudio code. In any case we need to take care of volume. |
135 renderer_->Render(v, number_of_frames, 0); | 141 renderer_->Render(v, number_of_frames, 0); |
136 } else { | 142 } else { |
137 // Provide silence if the source is not running. | 143 // Provide silence if the source is not running. |
138 for (size_t i = 0; i < audio_data.size(); ++i) | 144 for (size_t i = 0; i < audio_data.size(); ++i) |
139 memset(audio_data[i], 0, sizeof(float) * number_of_frames); | 145 memset(audio_data[i], 0, sizeof(float) * number_of_frames); |
140 } | 146 } |
141 } | 147 } |
OLD | NEW |