diff options
author | Glenn Kasten <gkasten@google.com> | 2014-01-17 19:15:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-01-17 19:15:57 +0000 |
commit | 0ce5ca5e113d58cbcb7cb48615d6dbbf3fbe7c66 (patch) | |
tree | b5f59ae15e5f5ea59a171f7677e2a8403361f80a /media/libmedia/AudioTrack.cpp | |
parent | d0b33f63a9364364a827e77da26b112edf3c4d6e (diff) | |
parent | 0cde076ddb283c84c3801a2df4cc3df99bd1577f (diff) | |
download | frameworks_av-0ce5ca5e113d58cbcb7cb48615d6dbbf3fbe7c66.zip frameworks_av-0ce5ca5e113d58cbcb7cb48615d6dbbf3fbe7c66.tar.gz frameworks_av-0ce5ca5e113d58cbcb7cb48615d6dbbf3fbe7c66.tar.bz2 |
Merge "Cleanup createTrack error handling"
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index d877199..640a2c9 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -1011,6 +1011,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); @@ -1018,7 +1023,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)) { |