Merge "The presence of the kKeyAACProfile is optional, we should not mandate its presence in AACWriter." into jb-dev
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 9391d16..b5b7adc 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1461,7 +1461,7 @@
 {
     // must be in this order to avoid a race condition
     Thread::requestExit();
-    mMyCond.signal();
+    resume();
 }
 
 void AudioTrack::AudioTrackThread::pause()
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index c35a77a..851321d 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -227,9 +227,15 @@
             if (mWaveFormat == WAVE_FORMAT_EXTENSIBLE) {
                 uint16_t validBitsPerSample = U16_LE_AT(&formatSpec[18]);
                 if (validBitsPerSample != mBitsPerSample) {
-                    ALOGE("validBits(%d) != bitsPerSample(%d) are not supported",
-                            validBitsPerSample, mBitsPerSample);
-                    return ERROR_UNSUPPORTED;
+                    if (validBitsPerSample != 0) {
+                        ALOGE("validBits(%d) != bitsPerSample(%d) are not supported",
+                                validBitsPerSample, mBitsPerSample);
+                        return ERROR_UNSUPPORTED;
+                    } else {
+                        // we only support valitBitsPerSample == bitsPerSample but some WAV_EXT
+                        // writers don't correctly set the valid bits value, and leave it at 0.
+                        ALOGW("WAVE_EXT has 0 valid bits per sample, ignoring");
+                    }
                 }
 
                 mChannelMask = U32_LE_AT(&formatSpec[20]);