Bug 1093318 - Pass newer AAC profile levels to the platform decoder module. r=edwin
--- a/media/libstagefright/binding/DecoderData.cpp
+++ b/media/libstagefright/binding/DecoderData.cpp
@@ -1,16 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mp4_demuxer/Adts.h"
#include "mp4_demuxer/AnnexB.h"
#include "mp4_demuxer/ByteReader.h"
#include "mp4_demuxer/DecoderData.h"
+#include <media/stagefright/foundation/ABitReader.h>
#include "media/stagefright/MetaData.h"
#include "media/stagefright/MediaBuffer.h"
#include "media/stagefright/MediaDefs.h"
#include "media/stagefright/Utils.h"
#include "mozilla/ArrayUtils.h"
#include "include/ESDS.h"
using namespace stagefright;
@@ -145,18 +146,26 @@ AudioDecoderConfig::Update(sp<MetaData>&
aac_profile = FindInt32(aMetaData, kKeyAACProfile);
if (FindData(aMetaData, kKeyESDS, &extra_data)) {
ESDS esds(&extra_data[0], extra_data.length());
const void* data;
size_t size;
if (esds.getCodecSpecificInfo(&data, &size) == OK) {
- audio_specific_config.append(reinterpret_cast<const uint8_t*>(data),
- size);
+ const uint8_t* cdata = reinterpret_cast<const uint8_t*>(data);
+ audio_specific_config.append(cdata, size);
+ if (size > 1) {
+ ABitReader br(cdata, size);
+ extended_profile = br.getBits(5);
+
+ if (extended_profile == 31) { // AAC-ELD => additional 6 bits
+ extended_profile = 32 + br.getBits(6);
+ }
+ }
}
}
}
bool
AudioDecoderConfig::IsValid()
{
return channel_count > 0 && samples_per_second > 0 && frequency_index > 0 &&
--- a/media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
+++ b/media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
@@ -92,24 +92,26 @@ class AudioDecoderConfig : public TrackC
{
public:
AudioDecoderConfig()
: channel_count(0)
, bits_per_sample(0)
, samples_per_second(0)
, frequency_index(0)
, aac_profile(0)
+ , extended_profile(0)
{
}
uint32_t channel_count;
uint32_t bits_per_sample;
uint32_t samples_per_second;
int8_t frequency_index;
int8_t aac_profile;
+ int8_t extended_profile;
mozilla::Vector<uint8_t> extra_data;
mozilla::Vector<uint8_t> audio_specific_config;
void Update(stagefright::sp<stagefright::MetaData>& aMetaData,
const char* aMimeType);
bool IsValid();
private: