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

Unified Diff: media/audio/mac/audio_low_latency_output_mac.cc

Issue 9834098: fix crash in AUAudioOutputStream::Render() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed Chris's comments Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/mac/audio_low_latency_output_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_low_latency_output_mac.cc
diff --git a/media/audio/mac/audio_low_latency_output_mac.cc b/media/audio/mac/audio_low_latency_output_mac.cc
index af23e6708f9bd2edaa0aae287b798d1b5b31e2a5..39ebf1aa09074e9154011bfac5a9df517924cc24 100644
--- a/media/audio/mac/audio_low_latency_output_mac.cc
+++ b/media/audio/mac/audio_low_latency_output_mac.cc
@@ -50,7 +50,8 @@ AUAudioOutputStream::AUAudioOutputStream(
output_unit_(0),
output_device_id_(kAudioObjectUnknown),
volume_(1),
- hardware_latency_frames_(0) {
+ hardware_latency_frames_(0),
+ stopped_(false) {
// We must have a manager.
DCHECK(manager_);
// A frame is one sample across all channels. In interleaved audio the per
@@ -178,6 +179,7 @@ void AUAudioOutputStream::Start(AudioSourceCallback* callback) {
if (!output_unit_)
return;
+ stopped_ = false;
source_ = callback;
AudioOutputUnitStart(output_unit_);
@@ -186,9 +188,13 @@ void AUAudioOutputStream::Start(AudioSourceCallback* callback) {
void AUAudioOutputStream::Stop() {
// We request a synchronous stop, so the next call can take some time. In
// the windows implementation we block here as well.
- source_ = NULL;
+ if (stopped_)
+ return;
AudioOutputUnitStop(output_unit_);
+
+ source_ = NULL;
+ stopped_ = true;
}
void AUAudioOutputStream::SetVolume(double volume) {
« no previous file with comments | « media/audio/mac/audio_low_latency_output_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698