OSDN Git Service

Improve error logging for getOutputSamplingRate
authorGlenn Kasten <gkasten@google.com>
Mon, 13 Jan 2014 18:25:53 +0000 (10:25 -0800)
committerGlenn Kasten <gkasten@google.com>
Mon, 13 Jan 2014 20:05:17 +0000 (12:05 -0800)
Change-Id: I3b52402a663b27efe1d7c6a4f684521f33f3ff8f

media/libmedia/AudioTrack.cpp

index a6ffc62..f9d335f 100644 (file)
@@ -245,12 +245,14 @@ status_t AudioTrack::set(
         streamType = AUDIO_STREAM_MUSIC;
     }
 
+    status_t status;
     if (sampleRate == 0) {
-        uint32_t afSampleRate;
-        if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) {
-            return NO_INIT;
+        status = AudioSystem::getOutputSamplingRate(&sampleRate, streamType);
+        if (status != NO_ERROR) {
+            ALOGE("Could not get output sample rate for stream type %d; status %d",
+                    streamType, status);
+            return status;
         }
-        sampleRate = afSampleRate;
     }
     mSampleRate = sampleRate;
 
@@ -338,7 +340,7 @@ status_t AudioTrack::set(
     }
 
     // create the IAudioTrack
-    status_t status = createTrack_l(streamType,
+    status = createTrack_l(streamType,
                                   sampleRate,
                                   format,
                                   frameCount,