summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-09-17 18:27:56 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-09-17 18:27:56 -0700
commit97c262fc848c407f316fd7fe2b468a540f3bc38f (patch)
tree7f2d78993184de1c5f3d0b5b11ef93d661bb3ce4
parent35a2c167b4ee090b5dd9779ecb40f82cdaf1c74d (diff)
downloadhardware_libhardware-97c262fc848c407f316fd7fe2b468a540f3bc38f.zip
hardware_libhardware-97c262fc848c407f316fd7fe2b468a540f3bc38f.tar.gz
hardware_libhardware-97c262fc848c407f316fd7fe2b468a540f3bc38f.tar.bz2
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
-rwxr-xr-xmodules/audio_remote_submix/audio_hw.cpp10
1 files changed, 5 insertions, 5 deletions
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);