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

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

Issue 481193003: Remove AudioBuffersState usage in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix audio muter build buster. Created 6 years, 2 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/mock_audio_source_callback.h ('k') | media/audio/simple_sources.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 "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/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "media/audio/audio_manager_base.h" 10 #include "media/audio/audio_manager_base.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 // NOTE: |bytes_to_fill| may be larger than |requested_bytes| now, this is 127 // NOTE: |bytes_to_fill| may be larger than |requested_bytes| now, this is
128 // okay since pa_stream_begin_write() is the authoritative source on how 128 // okay since pa_stream_begin_write() is the authoritative source on how
129 // much can be written. 129 // much can be written.
130 130
131 int frames_filled = 0; 131 int frames_filled = 0;
132 if (source_callback_) { 132 if (source_callback_) {
133 const uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( 133 const uint32 hardware_delay = pulse::GetHardwareLatencyInBytes(
134 pa_stream_, params_.sample_rate(), params_.GetBytesPerFrame()); 134 pa_stream_, params_.sample_rate(), params_.GetBytesPerFrame());
135 frames_filled = source_callback_->OnMoreData( 135 frames_filled = source_callback_->OnMoreData(
136 audio_bus_.get(), AudioBuffersState(0, hardware_delay)); 136 audio_bus_.get(), hardware_delay);
137 137
138 // Zero any unfilled data so it plays back as silence. 138 // Zero any unfilled data so it plays back as silence.
139 if (frames_filled < audio_bus_->frames()) { 139 if (frames_filled < audio_bus_->frames()) {
140 audio_bus_->ZeroFramesPartial( 140 audio_bus_->ZeroFramesPartial(
141 frames_filled, audio_bus_->frames() - frames_filled); 141 frames_filled, audio_bus_->frames() - frames_filled);
142 } 142 }
143 143
144 // Note: If this ever changes to output raw float the data must be clipped 144 // Note: If this ever changes to output raw float the data must be clipped
145 // and sanitized since it may come from an untrusted source such as NaCl. 145 // and sanitized since it may come from an untrusted source such as NaCl.
146 audio_bus_->Scale(volume_); 146 audio_bus_->Scale(volume_);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 volume_ = static_cast<float>(volume); 228 volume_ = static_cast<float>(volume);
229 } 229 }
230 230
231 void PulseAudioOutputStream::GetVolume(double* volume) { 231 void PulseAudioOutputStream::GetVolume(double* volume) {
232 DCHECK(thread_checker_.CalledOnValidThread()); 232 DCHECK(thread_checker_.CalledOnValidThread());
233 233
234 *volume = volume_; 234 *volume = volume_;
235 } 235 }
236 236
237 } // namespace media 237 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/mock_audio_source_callback.h ('k') | media/audio/simple_sources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698