diff options
author | Hugo Hudson <hugohudson@google.com> | 2011-09-09 14:46:15 +0100 |
---|---|---|
committer | Hugo Hudson <hugohudson@google.com> | 2011-09-09 14:46:15 +0100 |
commit | efaa38a16baad0f8665ac23f8e0a8ba166daf75d (patch) | |
tree | d620911894528b7d8670c0c5d000f5e6f1da87a0 /variablespeed | |
parent | 6caf49d02e7b2a719fc9fdf57e3f8e96dfdf082a (diff) | |
download | android_frameworks_ex-efaa38a16baad0f8665ac23f8e0a8ba166daf75d.tar.gz android_frameworks_ex-efaa38a16baad0f8665ac23f8e0a8ba166daf75d.tar.bz2 android_frameworks_ex-efaa38a16baad0f8665ac23f8e0a8ba166daf75d.zip |
Fix playback in variable speed audio.
- Recent changes to system/media broke variable speed playback.
- Traced to http://go/android-cl/132098 which presumed that variable
speed playback wasn't using the renamed sample rate field, but we
had our own copy of the field (it wasn't previously available in the
api).
- This cl also fixes the TODO by removing our own copy of the fields,
and using instead the defines from the OpenSL android api directly.
Bug: 5282965
Change-Id: I58033e9299d26d6a05259e4d50708d27fc3fa7e1
Diffstat (limited to 'variablespeed')
-rw-r--r-- | variablespeed/jni/variablespeed.cc | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/variablespeed/jni/variablespeed.cc b/variablespeed/jni/variablespeed.cc index 88eb783..ea134ec 100644 --- a/variablespeed/jni/variablespeed.cc +++ b/variablespeed/jni/variablespeed.cc @@ -46,11 +46,6 @@ const size_t kNumberOfSamplesPerBuffer = 1152; const size_t kBufferSizeInBytes = 2 * kNumberOfSamplesPerBuffer; const size_t kSampleSizeInBytes = 4; -// Keys used when extracting metadata from the decoder. -// TODO: Remove these constants once they are part of OpenSLES_Android.h. -const char* kKeyPcmFormatNumChannels = "AndroidPcmFormatNumChannels"; -const char* kKeyPcmFormatSamplesPerSec = "AndroidPcmFormatSamplesPerSec"; - // When calculating play buffer size before pushing to audio player. const size_t kNumberOfBytesPerInt16 = 2; @@ -246,11 +241,11 @@ static void ReadSampleRateAndChannelCount(CallbackContext *pContext, value = static_cast<SLMetadataInfo*>(malloc(valueSize)); if (value) { OpenSL(decoderMetadata, GetValue, i, valueSize, value); - if (strcmp((char*) keyInfo->data, kKeyPcmFormatSamplesPerSec) == 0) { + if (strcmp((char*) keyInfo->data, ANDROID_KEY_PCMFORMAT_SAMPLERATE) == 0) { SLuint32 sampleRate = *(reinterpret_cast<SLuint32*>(value->data)); LOGD("sample Rate: %d", sampleRate); *sampleRateOut = sampleRate; - } else if (strcmp((char*) keyInfo->data, kKeyPcmFormatNumChannels) == 0) { + } else if (strcmp((char*) keyInfo->data, ANDROID_KEY_PCMFORMAT_NUMCHANNELS) == 0) { SLuint32 channels = *(reinterpret_cast<SLuint32*>(value->data)); LOGD("channels: %d", channels); *channelsOut = channels; |