diff options
author | Glenn Kasten <gkasten@google.com> | 2014-01-17 20:00:48 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-01-17 20:00:48 +0000 |
commit | 543140eb709a07bc386eb5f667a4a72e31dba56c (patch) | |
tree | b48f2d74e75f6de5a8db09ac47eaf9caefc089ff /media/libmedia/AudioTrack.cpp | |
parent | 0ce5ca5e113d58cbcb7cb48615d6dbbf3fbe7c66 (diff) | |
parent | dd5f4c8c4059f890e81b28b026a688febb4e1dd9 (diff) | |
download | frameworks_av-543140eb709a07bc386eb5f667a4a72e31dba56c.zip frameworks_av-543140eb709a07bc386eb5f667a4a72e31dba56c.tar.gz frameworks_av-543140eb709a07bc386eb5f667a4a72e31dba56c.tar.bz2 |
Merge "Move up initialization of mFormat, mStreamType, and mSharedBuffer earlier"
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 640a2c9..7e6074d 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -222,6 +222,7 @@ status_t AudioTrack::set( ALOGE("Invalid transfer type %d", transferType); return BAD_VALUE; } + mSharedBuffer = sharedBuffer; mTransfer = transferType; // FIXME "int" here is legacy and will be replaced by size_t later @@ -250,6 +251,11 @@ status_t AudioTrack::set( if (streamType == AUDIO_STREAM_DEFAULT) { streamType = AUDIO_STREAM_MUSIC; } + if (uint32_t(streamType) >= AUDIO_STREAM_CNT) { + ALOGE("Invalid stream type %d", streamType); + return BAD_VALUE; + } + mStreamType = streamType; status_t status; if (sampleRate == 0) { @@ -272,6 +278,7 @@ status_t AudioTrack::set( ALOGE("Invalid format %d", format); return BAD_VALUE; } + mFormat = format; if (!audio_is_output_channel(channelMask)) { ALOGE("Invalid channel mask %#x", channelMask); @@ -369,9 +376,6 @@ status_t AudioTrack::set( } mStatus = NO_ERROR; - mStreamType = streamType; - mFormat = format; - mSharedBuffer = sharedBuffer; mState = STATE_STOPPED; mUserData = user; mLoopPeriod = 0; |