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

Side by Side Diff: media/audio/pulse/pulse_output.cc

Issue 16103007: Privitize WaitTillDataReady() and DataReady(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gotta catch'em all! Created 7 years, 6 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 | « media/audio/pulse/pulse_input.cc ('k') | media/audio/pulse/pulse_unified.cc » ('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 "media/audio/pulse/pulse_output.h" 5 #include "media/audio/pulse/pulse_output.h"
6 6
7 #include <pulse/pulseaudio.h> 7 #include <pulse/pulseaudio.h>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "media/audio/audio_manager_base.h" 10 #include "media/audio/audio_manager_base.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 void* buffer = NULL; 122 void* buffer = NULL;
123 size_t bytes_to_fill = params_.GetBytesPerBuffer(); 123 size_t bytes_to_fill = params_.GetBytesPerBuffer();
124 CHECK_GE(pa_stream_begin_write(pa_stream_, &buffer, &bytes_to_fill), 0); 124 CHECK_GE(pa_stream_begin_write(pa_stream_, &buffer, &bytes_to_fill), 0);
125 CHECK_EQ(bytes_to_fill, static_cast<size_t>(params_.GetBytesPerBuffer())); 125 CHECK_EQ(bytes_to_fill, static_cast<size_t>(params_.GetBytesPerBuffer()));
126 126
127 int frames_filled = 0; 127 int frames_filled = 0;
128 if (source_callback_) { 128 if (source_callback_) {
129 uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( 129 uint32 hardware_delay = pulse::GetHardwareLatencyInBytes(
130 pa_stream_, params_.sample_rate(), 130 pa_stream_, params_.sample_rate(),
131 params_.GetBytesPerFrame()); 131 params_.GetBytesPerFrame());
132 source_callback_->WaitTillDataReady();
133 frames_filled = source_callback_->OnMoreData( 132 frames_filled = source_callback_->OnMoreData(
134 audio_bus_.get(), AudioBuffersState(0, hardware_delay)); 133 audio_bus_.get(), AudioBuffersState(0, hardware_delay));
135 } 134 }
136 135
137 // Zero any unfilled data so it plays back as silence. 136 // Zero any unfilled data so it plays back as silence.
138 if (frames_filled < audio_bus_->frames()) { 137 if (frames_filled < audio_bus_->frames()) {
139 audio_bus_->ZeroFramesPartial( 138 audio_bus_->ZeroFramesPartial(
140 frames_filled, audio_bus_->frames() - frames_filled); 139 frames_filled, audio_bus_->frames() - frames_filled);
141 } 140 }
142 141
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 volume_ = static_cast<float>(volume); 207 volume_ = static_cast<float>(volume);
209 } 208 }
210 209
211 void PulseAudioOutputStream::GetVolume(double* volume) { 210 void PulseAudioOutputStream::GetVolume(double* volume) {
212 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); 211 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread());
213 212
214 *volume = volume_; 213 *volume = volume_;
215 } 214 }
216 215
217 } // namespace media 216 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/pulse/pulse_input.cc ('k') | media/audio/pulse/pulse_unified.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698