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

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

Issue 12328084: Fix the choppiness for the pulse impl when using a smaller buffer size like 512 samples (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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.sigs ('k') | no next file » | 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (pa_stream_write(pa_stream_, buffer, bytes_to_fill, NULL, 0LL, 281 if (pa_stream_write(pa_stream_, buffer, bytes_to_fill, NULL, 0LL,
282 PA_SEEK_RELATIVE) < 0) { 282 PA_SEEK_RELATIVE) < 0) {
283 if (source_callback_) { 283 if (source_callback_) {
284 source_callback_->OnError(this, pa_context_errno(pa_context_)); 284 source_callback_->OnError(this, pa_context_errno(pa_context_));
285 } 285 }
286 } 286 }
287 287
288 bytes_remaining -= bytes_to_fill; 288 bytes_remaining -= bytes_to_fill;
289 current_frame = frames_to_fill; 289 current_frame = frames_to_fill;
290 } 290 }
291
292 size_t avialable_space = pa_stream_writable_size(pa_stream_);
DaleCurtis 2013/02/25 19:01:29 s/avialable_space/available_space/
no longer working on chromium 2013/02/25 20:03:19 Sorry, I will change it to writable_space
293 if (avialable_space >= static_cast<size_t>(params_.GetBytesPerBuffer())) {
294 if (source_callback_)
295 source_callback_->WaitTillDataReady();
296
297 FulfillWriteRequest(params_.GetBytesPerBuffer());
DaleCurtis 2013/02/25 19:01:29 Hmm, won't this cause faster than normal playback?
no longer working on chromium 2013/02/25 20:03:19 It should not cause fast playback, since we query
298 }
291 } 299 }
292 300
293 void PulseAudioOutputStream::Start(AudioSourceCallback* callback) { 301 void PulseAudioOutputStream::Start(AudioSourceCallback* callback) {
294 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); 302 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread());
295 CHECK(callback); 303 CHECK(callback);
296 CHECK(pa_stream_); 304 CHECK(pa_stream_);
297 305
298 AutoPulseLock auto_lock(pa_mainloop_); 306 AutoPulseLock auto_lock(pa_mainloop_);
299 307
300 // Ensure the context and stream are ready. 308 // Ensure the context and stream are ready.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 volume_ = static_cast<float>(volume); 347 volume_ = static_cast<float>(volume);
340 } 348 }
341 349
342 void PulseAudioOutputStream::GetVolume(double* volume) { 350 void PulseAudioOutputStream::GetVolume(double* volume) {
343 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); 351 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread());
344 352
345 *volume = volume_; 353 *volume = volume_;
346 } 354 }
347 355
348 } // namespace media 356 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/pulse/pulse.sigs ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698