diff options
author | Marco Nelissen <marcone@google.com> | 2015-03-20 09:15:11 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2015-03-20 09:15:11 -0700 |
commit | 17c39e708ed657b8fa66f8acce5128e51696915c (patch) | |
tree | ec0f96c66e44c39e83800bb7a02792ab57781e99 /media/libstagefright/OMXCodec.cpp | |
parent | 340cebdaa2875ba2ab9725b81218ebc59d84164b (diff) | |
download | frameworks_av-17c39e708ed657b8fa66f8acce5128e51696915c.zip frameworks_av-17c39e708ed657b8fa66f8acce5128e51696915c.tar.gz frameworks_av-17c39e708ed657b8fa66f8acce5128e51696915c.tar.bz2 |
ulaw and alaw aren't limited to 8kHz
Bug: https://code.google.com/p/android/issues/detail?id=158490
Change-Id: Ib30e156c99a997db861bb85e17244a5effdd55cf
Diffstat (limited to 'media/libstagefright/OMXCodec.cpp')
-rw-r--r-- | media/libstagefright/OMXCodec.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index ea19ab2..4d30069 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -629,10 +629,14 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) { // These are PCM-like formats with a fixed sample rate but // a variable number of channels. + int32_t sampleRate; int32_t numChannels; CHECK(meta->findInt32(kKeyChannelCount, &numChannels)); + if (!meta->findInt32(kKeySampleRate, &sampleRate)) { + sampleRate = 8000; + } - setG711Format(numChannels); + setG711Format(sampleRate, numChannels); } else if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_RAW, mMIME)) { CHECK(!mIsEncoder); @@ -3616,9 +3620,9 @@ status_t OMXCodec::setAC3Format(int32_t numChannels, int32_t sampleRate) { sizeof(def)); } -void OMXCodec::setG711Format(int32_t numChannels) { +void OMXCodec::setG711Format(int32_t sampleRate, int32_t numChannels) { CHECK(!mIsEncoder); - setRawAudioFormat(kPortIndexInput, 8000, numChannels); + setRawAudioFormat(kPortIndexInput, sampleRate, numChannels); } void OMXCodec::setImageOutputFormat( |