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

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: 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..5dfb2c057a011b5364460e6b721d0bb99fc51da0 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,14 @@ 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;
+
+ stopped_ = true;
Chris Rogers 2012/03/28 18:55:10 Should this maybe be set to "true" only after Audi
no longer working on chromium 2012/03/28 19:25:32 Done.
AudioOutputUnitStop(output_unit_);
+
+ source_ = NULL;
}
void AUAudioOutputStream::SetVolume(double volume) {
@@ -211,6 +218,9 @@ void AUAudioOutputStream::GetVolume(double* volume) {
OSStatus AUAudioOutputStream::Render(UInt32 number_of_frames,
AudioBufferList* io_data,
const AudioTimeStamp* output_time_stamp) {
+ if (stopped_)
no longer working on chromium 2012/03/27 11:01:32 I don't use atomic operation here since there is c
Chris Rogers 2012/03/28 18:55:10 Strictly speaking, I don't think it's even necessa
no longer working on chromium 2012/03/28 19:25:32 True, thanks for pointing out. It just feels safer
+ return -1;
+
// Update the playout latency.
double playout_latency_frames = GetPlayoutLatency(output_time_stamp);
« 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