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

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

Issue 8872028: Make check for 'opened' consistent across all audio stream implementations of Start() and log an ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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/mac/audio_output_mac.cc ('k') | media/audio/win/audio_low_latency_input_win.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "media/audio/audio_parameters.h" 9 #include "media/audio/audio_parameters.h"
10 #include "media/audio/audio_util.h" 10 #include "media/audio/audio_util.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // Write data to stream. 376 // Write data to stream.
377 pa_stream_write(playback_handle_, chunk, chunk_size, 377 pa_stream_write(playback_handle_, chunk, chunk_size,
378 NULL, 0LL, PA_SEEK_RELATIVE); 378 NULL, 0LL, PA_SEEK_RELATIVE);
379 client_buffer_->Seek(chunk_size); 379 client_buffer_->Seek(chunk_size);
380 *bytes_written += chunk_size; 380 *bytes_written += chunk_size;
381 } 381 }
382 } 382 }
383 383
384 void PulseAudioOutputStream::Start(AudioSourceCallback* callback) { 384 void PulseAudioOutputStream::Start(AudioSourceCallback* callback) {
385 DCHECK_EQ(message_loop_, MessageLoop::current()); 385 DCHECK_EQ(message_loop_, MessageLoop::current());
386 CHECK(callback);
387 DLOG_IF(ERROR, !playback_handle_)
388 << "Open() has not been called successfully";
389 if (!playback_handle_)
390 return;
386 391
387 CHECK(callback);
388 source_callback_ = callback; 392 source_callback_ = callback;
389 393
390 // Clear buffer, it might still have data in it. 394 // Clear buffer, it might still have data in it.
391 client_buffer_->Clear(); 395 client_buffer_->Clear();
392 stream_stopped_ = false; 396 stream_stopped_ = false;
393 397
394 // Start playback. 398 // Start playback.
395 message_loop_->PostTask(FROM_HERE, base::Bind( 399 message_loop_->PostTask(FROM_HERE, base::Bind(
396 &PulseAudioOutputStream::WaitForWriteRequest, 400 &PulseAudioOutputStream::WaitForWriteRequest,
397 weak_factory_.GetWeakPtr())); 401 weak_factory_.GetWeakPtr()));
(...skipping 17 matching lines...) Expand all
415 *volume = volume_; 419 *volume = volume_;
416 } 420 }
417 421
418 uint32 PulseAudioOutputStream::RunDataCallback( 422 uint32 PulseAudioOutputStream::RunDataCallback(
419 uint8* dest, uint32 max_size, AudioBuffersState buffers_state) { 423 uint8* dest, uint32 max_size, AudioBuffersState buffers_state) {
420 if (source_callback_) 424 if (source_callback_)
421 return source_callback_->OnMoreData(this, dest, max_size, buffers_state); 425 return source_callback_->OnMoreData(this, dest, max_size, buffers_state);
422 426
423 return 0; 427 return 0;
424 } 428 }
OLDNEW
« no previous file with comments | « media/audio/mac/audio_output_mac.cc ('k') | media/audio/win/audio_low_latency_input_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698