Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: content/renderer/media/render_audiosourceprovider.cc

Issue 10837032: Fix playback rate w/o audio. Remove unused SetPlaybackRate(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/render_audiosourceprovider.h ('k') | media/audio/null_audio_sink.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 is_running_ = true; 108 is_running_ = true;
109 } 109 }
110 110
111 void RenderAudioSourceProvider::Pause(bool flush) { 111 void RenderAudioSourceProvider::Pause(bool flush) {
112 base::AutoLock auto_lock(sink_lock_); 112 base::AutoLock auto_lock(sink_lock_);
113 if (!client_) 113 if (!client_)
114 default_sink_->Pause(flush); 114 default_sink_->Pause(flush);
115 is_running_ = false; 115 is_running_ = false;
116 } 116 }
117 117
118 void RenderAudioSourceProvider::SetPlaybackRate(float rate) {
119 base::AutoLock auto_lock(sink_lock_);
120 if (!client_)
121 default_sink_->SetPlaybackRate(rate);
122 }
123
124 bool RenderAudioSourceProvider::SetVolume(double volume) { 118 bool RenderAudioSourceProvider::SetVolume(double volume) {
125 base::AutoLock auto_lock(sink_lock_); 119 base::AutoLock auto_lock(sink_lock_);
126 if (!client_) 120 if (!client_)
127 default_sink_->SetVolume(volume); 121 default_sink_->SetVolume(volume);
128 return true; 122 return true;
129 } 123 }
130 124
131 void RenderAudioSourceProvider::Initialize( 125 void RenderAudioSourceProvider::Initialize(
132 const media::AudioParameters& params, 126 const media::AudioParameters& params,
133 RenderCallback* renderer) { 127 RenderCallback* renderer) {
134 base::AutoLock auto_lock(sink_lock_); 128 base::AutoLock auto_lock(sink_lock_);
135 CHECK(!is_initialized_); 129 CHECK(!is_initialized_);
136 renderer_ = renderer; 130 renderer_ = renderer;
137 131
138 default_sink_->Initialize(params, renderer); 132 default_sink_->Initialize(params, renderer);
139 133
140 // Keep track of the format in case the client hasn't yet been set. 134 // Keep track of the format in case the client hasn't yet been set.
141 channels_ = params.channels(); 135 channels_ = params.channels();
142 sample_rate_ = params.sample_rate(); 136 sample_rate_ = params.sample_rate();
143 137
144 if (client_) { 138 if (client_) {
145 // Inform WebKit about the audio stream format. 139 // Inform WebKit about the audio stream format.
146 client_->setFormat(channels_, sample_rate_); 140 client_->setFormat(channels_, sample_rate_);
147 } 141 }
148 142
149 is_initialized_ = true; 143 is_initialized_ = true;
150 } 144 }
151 145
152 RenderAudioSourceProvider::~RenderAudioSourceProvider() {} 146 RenderAudioSourceProvider::~RenderAudioSourceProvider() {}
OLDNEW
« no previous file with comments | « content/renderer/media/render_audiosourceprovider.h ('k') | media/audio/null_audio_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698