summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-01-16 15:06:36 -0800
committerGlenn Kasten <gkasten@google.com>2014-01-16 17:01:04 -0800
commit0cde076ddb283c84c3801a2df4cc3df99bd1577f (patch)
tree9f1d49f9fc52a5cedea8e0bd14555a70ab5772b0 /media/libmedia/AudioTrack.cpp
parenta238b9b43a2b8dac60e0fd8700daa6cd4f644547 (diff)
downloadframeworks_av-0cde076ddb283c84c3801a2df4cc3df99bd1577f.zip
frameworks_av-0cde076ddb283c84c3801a2df4cc3df99bd1577f.tar.gz
frameworks_av-0cde076ddb283c84c3801a2df4cc3df99bd1577f.tar.bz2
Cleanup createTrack error handling
Similar to cleanup done earlier for openRecord in this CL: > Change-Id: I84897dd7d30b370640b54e928f230604b873cb68 Bug: 10888816 Change-Id: I804a47f898e0319a60a9bd58906bbb037e45cc25
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r--media/libmedia/AudioTrack.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index d5e3e67..a113f77 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1004,6 +1004,11 @@ status_t AudioTrack::createTrack_l(
ALOGE("Could not get control block");
return NO_INIT;
}
+ void *iMemPointer = iMem->pointer();
+ if (iMemPointer == NULL) {
+ ALOGE("Could not get control block pointer");
+ return NO_INIT;
+ }
// invariant that mAudioTrack != 0 is true only after set() returns successfully
if (mAudioTrack != 0) {
mAudioTrack->asBinder()->unlinkToDeath(mDeathNotifier, this);
@@ -1011,7 +1016,7 @@ status_t AudioTrack::createTrack_l(
}
mAudioTrack = track;
mCblkMemory = iMem;
- audio_track_cblk_t* cblk = static_cast<audio_track_cblk_t*>(iMem->pointer());
+ audio_track_cblk_t* cblk = static_cast<audio_track_cblk_t*>(iMemPointer);
mCblk = cblk;
size_t temp = cblk->frameCount_;
if (temp < frameCount || (frameCount == 0 && temp == 0)) {