Bug 1355933: P6. Hook up ADTS sniffer. r=kamidphish

MozReview-Commit-ID: 3aYmCRRbRzg

--HG--
extra : rebase_source : bec12e1f81e90a4bc1ddbb46c57f81c2a968a9ca
This commit is contained in:
Jean-Yves Avenard 2017-04-13 02:40:35 +02:00
parent 73db8daa39
commit fca0f47212
2 changed files with 12 additions and 0 deletions

View File

@ -88,6 +88,7 @@
#define AUDIO_3GPP2 "audio/3gpp2"
#define AUDIO_MIDI "audio/x-midi"
#define AUDIO_MATROSKA "audio/x-matroska"
#define AUDIO_AAC "audio/aac"
#define BINARY_OCTET_STREAM "binary/octet-stream"

View File

@ -4,6 +4,7 @@
* 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 "ADTSDemuxer.h"
#include "FlacDemuxer.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/ModuleUtils.h"
@ -130,6 +131,11 @@ static bool MatchesFLAC(const uint8_t* aData, const uint32_t aLength)
return mozilla::FlacDemuxer::FlacSniffer(aData, aLength);
}
static bool MatchesADTS(const uint8_t* aData, const uint32_t aLength)
{
return mozilla::ADTSDemuxer::ADTSSniffer(aData, aLength);
}
NS_IMETHODIMP
nsMediaSniffer::GetMIMETypeFromContent(nsIRequest* aRequest,
const uint8_t* aData,
@ -197,6 +203,11 @@ nsMediaSniffer::GetMIMETypeFromContent(nsIRequest* aRequest,
return NS_OK;
}
if (MatchesADTS(aData, clampedLength)) {
aSniffedType.AssignLiteral(AUDIO_AAC);
return NS_OK;
}
// Could not sniff the media type, we are required to set it to
// application/octet-stream.
aSniffedType.AssignLiteral(APPLICATION_OCTET_STREAM);