Skip to content

Commit f0a6ff3

Browse files
committed
Bug 1749044 - Teach the WMF audio decoder to handle ADTS. r=chunmin
Differential Revision: https://phabricator.services.mozilla.com/D192685
1 parent 2bfaeea commit f0a6ff3

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

dom/media/platforms/wmf/WMFAudioMFTManager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ WMFAudioMFTManager::WMFAudioMFTManager(const AudioInfo& aConfig)
5555
audioSpecConfig = audioCodecSpecificBinaryBlob->Elements();
5656
configLength = audioCodecSpecificBinaryBlob->Length();
5757
}
58+
// If no extradata has been provided, assume this is ADTS. Otherwise,
59+
// assume raw AAC packets.
60+
mIsADTS = !configLength;
5861
AACAudioSpecificConfigToUserData(aConfig.mExtendedProfile, audioSpecConfig,
5962
configLength, mUserData);
6063
}
@@ -104,7 +107,8 @@ bool WMFAudioMFTManager::Init() {
104107
NS_ENSURE_TRUE(SUCCEEDED(hr), false);
105108

106109
if (mStreamType == WMFStreamType::AAC) {
107-
hr = inputType->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 0x0); // Raw AAC packet
110+
UINT32 payloadType = mIsADTS ? 1 : 0;
111+
hr = inputType->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, payloadType);
108112
NS_ENSURE_TRUE(SUCCEEDED(hr), false);
109113

110114
hr = inputType->SetBlob(MF_MT_USER_DATA, mUserData.Elements(),

dom/media/platforms/wmf/WMFAudioMFTManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class WMFAudioMFTManager : public MFTManager {
5858
media::TimeUnit mLastOutputDuration = media::TimeUnit::Zero();
5959

6060
bool mFirstFrame = true;
61+
bool mIsADTS = false;
6162

6263
uint64_t mTotalMediaFrames = 0;
6364
uint32_t mEncoderDelay = 0;

dom/media/platforms/wmf/WMFUtils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ void AACAudioSpecificConfigToUserData(uint8_t aAACProfileLevelIndication,
374374
// the rest can be all 0x00.
375375
BYTE heeInfo[heeInfoLen] = {0};
376376
WORD* w = (WORD*)heeInfo;
377-
w[0] = 0x0; // Payload type raw AAC packet
377+
// If extradata has been provided, assume raw AAC packets (0). Otherwise,
378+
// assume ADTS (1)
379+
w[0] = aConfigLength ? 0 : 1;
378380
w[1] = aAACProfileLevelIndication;
379381

380382
aOutUserData.AppendElements(heeInfo, heeInfoLen);

0 commit comments

Comments
 (0)