Bug 1387127 - Correctly set AudioInfo.mProfile. r=kamidphish

AudioInfo::mProfile is used to detect the type of AAC content we have stored from 1 to 4 as would be stored in an ADTS packet.
1: AAC Main
2: AAC LC (Low Complexity)
3: AAC SSR (Scalable Sample Rate)
4: AAC LTP (Long Term Prediction)
It is not used to store the profile level indication.

This caused the ADTS conversion needed by the Apple AudioToolbox decoder  to fail, interrupting the detection of the inband SBR.

MozReview-Commit-ID: 1gf4HIMyCPo

--HG--
extra : rebase_source : 7ddb98e88d5516bd01f8f39156d8ee71fb32cc2e
This commit is contained in:
Jean-Yves Avenard 2017-11-22 20:39:27 +01:00
parent c1c5121e36
commit d1985718a4

View File

@ -234,48 +234,6 @@ private:
Frame mFrame;
};
// Return the AAC Profile Level Indication based upon sample rate and channels
// Information based upon table 1.10 from ISO/IEC 14496-3:2005(E)
static int8_t
ProfileLevelIndication(const Frame& frame)
{
const FrameHeader& header = frame.Header();
MOZ_ASSERT(header.IsValid());
if (!header.IsValid()) {
return 0;
}
const int channels = header.mChannels;
const int sampleRate = header.mSampleRate;
if (channels <= 2) {
if (sampleRate <= 24000) {
// AAC Profile L1
return 0x28;
}
else if (sampleRate <= 48000) {
// AAC Profile L2
return 0x29;
}
}
else if (channels <= 5) {
if (sampleRate <= 48000) {
// AAC Profile L4
return 0x2A;
}
else if (sampleRate <= 96000) {
// AAC Profile L5
return 0x2B;
}
}
// TODO: Should this be 0xFE for 'no audio profile specified'?
return 0;
}
// Initialize the AAC AudioSpecificConfig.
// Only handles two-byte version for AAC-LC.
static void
@ -406,15 +364,10 @@ ADTSTrackDemuxer::Init()
mInfo->mMimeType = "audio/mp4a-latm";
// Configure AAC codec-specific values.
// According to
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd742784%28v=vs.85%29.aspx,
// wAudioProfileLevelIndication, which is passed mInfo->mProfile, is
// a value from Table 1.12 -- audioProfileLevelIndication values, ISO/IEC 14496-3.
mInfo->mProfile = ProfileLevelIndication(mParser->FirstFrame());
// For AAC, mExtendedProfile contains the audioObjectType from Table
// 1.3 -- Audio Profile definition, ISO/IEC 14496-3. Eg. 2 == AAC LC
mInfo->mExtendedProfile = mParser->FirstFrame().Header().mObjectType;
// For AAC, mProfile and mExtendedProfile contain the audioObjectType from
// Table 1.3 -- Audio Profile definition, ISO/IEC 14496-3. Eg. 2 == AAC LC
mInfo->mProfile = mInfo->mExtendedProfile =
mParser->FirstFrame().Header().mObjectType;
InitAudioSpecificConfig(mParser->FirstFrame(), mInfo->mCodecSpecificConfig);
ADTSLOG("Init mInfo={mRate=%u mChannels=%u mBitDepth=%u mDuration=%" PRId64