From 97c262fc848c407f316fd7fe2b468a540f3bc38f Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 17 Sep 2012 18:27:56 -0700 Subject: Remote submix: fix sink/source reference count handling The reference count on the strong pointers to the audio sink and source should be done on the object retrieved from the device structure, not by accessing the corresponding fields, as they can be cleared while reading or writing audio data. Change-Id: I446a2c7bdcb0758b4013b0ad75450a15203fb9da --- modules/audio_remote_submix/audio_hw.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp index 82bac1a..0f8adab 100755 --- a/modules/audio_remote_submix/audio_hw.cpp +++ b/modules/audio_remote_submix/audio_hw.cpp @@ -212,7 +212,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, MonoPipe* sink = out->dev->rsxSink.get(); if (sink != NULL) { - out->dev->rsxSink->incStrong(buffer); + sink->incStrong(buffer); } else { pthread_mutex_unlock(&out->dev->lock); ALOGE("out_write without a pipe!"); @@ -230,7 +230,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, ALOGE("out_write() write to pipe returned NEGOTIATE"); pthread_mutex_lock(&out->dev->lock); - out->dev->rsxSink->decStrong(buffer); + sink->decStrong(buffer); pthread_mutex_unlock(&out->dev->lock); written_frames = 0; @@ -244,7 +244,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, pthread_mutex_lock(&out->dev->lock); - out->dev->rsxSink->decStrong(buffer); + sink->decStrong(buffer); pthread_mutex_unlock(&out->dev->lock); @@ -382,7 +382,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, MonoPipeReader* source = in->dev->rsxSource.get(); if (source != NULL) { - in->dev->rsxSource->incStrong(in); + source->incStrong(buffer); } else { ALOGE("no audio pipe yet we're trying to read!"); pthread_mutex_unlock(&in->dev->lock); @@ -414,7 +414,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, // done using the source pthread_mutex_lock(&in->dev->lock); - in->dev->rsxSource->decStrong(in); + source->decStrong(buffer); pthread_mutex_unlock(&in->dev->lock); -- cgit v1.1