summaryrefslogtreecommitdiffstats
path: root/variablespeed/jni/variablespeed.cc
diff options
context:
space:
mode:
Diffstat (limited to 'variablespeed/jni/variablespeed.cc')
-rw-r--r--variablespeed/jni/variablespeed.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/variablespeed/jni/variablespeed.cc b/variablespeed/jni/variablespeed.cc
index ea134ec..bf132c6 100644
--- a/variablespeed/jni/variablespeed.cc
+++ b/variablespeed/jni/variablespeed.cc
@@ -242,11 +242,13 @@ static void ReadSampleRateAndChannelCount(CallbackContext *pContext,
if (value) {
OpenSL(decoderMetadata, GetValue, i, valueSize, value);
if (strcmp((char*) keyInfo->data, ANDROID_KEY_PCMFORMAT_SAMPLERATE) == 0) {
- SLuint32 sampleRate = *(reinterpret_cast<SLuint32*>(value->data));
+ SLuint32 sampleRate;
+ memcpy(&sampleRate, value->data, sizeof(SLuint32));
LOGD("sample Rate: %d", sampleRate);
*sampleRateOut = sampleRate;
} else if (strcmp((char*) keyInfo->data, ANDROID_KEY_PCMFORMAT_NUMCHANNELS) == 0) {
- SLuint32 channels = *(reinterpret_cast<SLuint32*>(value->data));
+ SLuint32 channels;
+ memcpy(&channels, value->data, sizeof(SLuint32));
LOGD("channels: %d", channels);
*channelsOut = channels;
}