OSDN Git Service

Fix AudioRecord
authorGlenn Kasten <gkasten@google.com>
Thu, 10 Jan 2013 22:26:24 +0000 (14:26 -0800)
committerGlenn Kasten <gkasten@google.com>
Thu, 10 Jan 2013 22:52:24 +0000 (14:52 -0800)
Bug: 7965744
Change-Id: Ic024e7fb32f7459b8093c2cf6cd5752aade21ddb

media/libmedia/AudioRecord.cpp

index 4f555c1..0a2b0b0 100644 (file)
@@ -164,6 +164,7 @@ status_t AudioRecord::set(
         ALOGE("Invalid format");
         return BAD_VALUE;
     }
+    mFormat = format;
 
     if (!audio_is_input_channel(channelMask)) {
         return BAD_VALUE;
@@ -172,7 +173,7 @@ status_t AudioRecord::set(
     uint32_t channelCount = popcount(channelMask);
     mChannelCount = channelCount;
 
-    if (audio_is_linear_pcm(mFormat)) {
+    if (audio_is_linear_pcm(format)) {
         mFrameSize = channelCount * audio_bytes_per_sample(format);
     } else {
         mFrameSize = sizeof(uint8_t);
@@ -226,7 +227,6 @@ status_t AudioRecord::set(
 
     mStatus = NO_ERROR;
 
-    mFormat = format;
     // Update buffer size in case it has been limited by AudioFlinger during track creation
     mFrameCount = mCblk->frameCount_;