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

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
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_) << "Must call Open() first";
388 if (!playback_handle_)
389 return;
386 390
387 CHECK(callback);
388 source_callback_ = callback; 391 source_callback_ = callback;
389 392
390 // Clear buffer, it might still have data in it. 393 // Clear buffer, it might still have data in it.
391 client_buffer_->Clear(); 394 client_buffer_->Clear();
392 stream_stopped_ = false; 395 stream_stopped_ = false;
393 396
394 // Start playback. 397 // Start playback.
395 message_loop_->PostTask(FROM_HERE, base::Bind( 398 message_loop_->PostTask(FROM_HERE, base::Bind(
396 &PulseAudioOutputStream::WaitForWriteRequest, 399 &PulseAudioOutputStream::WaitForWriteRequest,
397 weak_factory_.GetWeakPtr())); 400 weak_factory_.GetWeakPtr()));
(...skipping 17 matching lines...) Expand all
415 *volume = volume_; 418 *volume = volume_;
416 } 419 }
417 420
418 uint32 PulseAudioOutputStream::RunDataCallback( 421 uint32 PulseAudioOutputStream::RunDataCallback(
419 uint8* dest, uint32 max_size, AudioBuffersState buffers_state) { 422 uint8* dest, uint32 max_size, AudioBuffersState buffers_state) {
420 if (source_callback_) 423 if (source_callback_)
421 return source_callback_->OnMoreData(this, dest, max_size, buffers_state); 424 return source_callback_->OnMoreData(this, dest, max_size, buffers_state);
422 425
423 return 0; 426 return 0;
424 } 427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698