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
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 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 @@
         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;