From 0cde076ddb283c84c3801a2df4cc3df99bd1577f Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Thu, 16 Jan 2014 15:06:36 -0800 Subject: Cleanup createTrack error handling Similar to cleanup done earlier for openRecord in this CL: > Change-Id: I84897dd7d30b370640b54e928f230604b873cb68 Bug: 10888816 Change-Id: I804a47f898e0319a60a9bd58906bbb037e45cc25 --- media/libmedia/IAudioFlinger.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'media/libmedia/IAudioFlinger.cpp') diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index c9c8d58..ecbb5bf 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -138,6 +138,17 @@ public: name = reply.readString8(); lStatus = reply.readInt32(); track = interface_cast(reply.readStrongBinder()); + if (lStatus == NO_ERROR) { + if (track == 0) { + ALOGE("createTrack should have returned an IAudioTrack"); + lStatus = UNKNOWN_ERROR; + } + } else { + if (track != 0) { + ALOGE("createTrack returned an IAudioTrack but with status %d", lStatus); + track.clear(); + } + } } if (status != NULL) { *status = lStatus; @@ -795,6 +806,7 @@ status_t BnAudioFlinger::onTransact( (audio_stream_type_t) streamType, sampleRate, format, channelMask, frameCount, &flags, buffer, output, tid, &sessionId, name, clientUid, &status); + LOG_ALWAYS_FATAL_IF((track != 0) != (status == NO_ERROR)); } reply->writeInt32(flags); reply->writeInt32(sessionId); -- cgit v1.1