mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 1749044 - Fix warnings in WMF code. r=chunmin
Differential Revision: https://phabricator.services.mozilla.com/D192684
This commit is contained in:
parent
5d24210b4f
commit
2b58bae621
@ -144,7 +144,8 @@ WMFAudioMFTManager::Input(MediaRawData* aSample) {
|
||||
nsCString WMFAudioMFTManager::GetCodecName() const {
|
||||
if (mStreamType == WMFStreamType::AAC) {
|
||||
return "aac"_ns;
|
||||
} else if (mStreamType == WMFStreamType::MP3) {
|
||||
}
|
||||
if (mStreamType == WMFStreamType::MP3) {
|
||||
return "mp3"_ns;
|
||||
}
|
||||
return "unknown"_ns;
|
||||
@ -177,8 +178,8 @@ WMFAudioMFTManager::UpdateOutputType() {
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WMFAudioMFTManager::Output(int64_t aStreamOffset, RefPtr<MediaData>& aOutData) {
|
||||
aOutData = nullptr;
|
||||
WMFAudioMFTManager::Output(int64_t aStreamOffset, RefPtr<MediaData>& aOutput) {
|
||||
aOutput = nullptr;
|
||||
RefPtr<IMFSample> sample;
|
||||
HRESULT hr;
|
||||
int typeChangeCount = 0;
|
||||
@ -242,8 +243,8 @@ WMFAudioMFTManager::Output(int64_t aStreamOffset, RefPtr<MediaData>& aOutData) {
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
|
||||
// Output is made of floats.
|
||||
int32_t numSamples = currentLength / sizeof(float);
|
||||
int32_t numFrames = numSamples / mAudioChannels;
|
||||
uint32_t numSamples = currentLength / sizeof(float);
|
||||
uint32_t numFrames = numSamples / mAudioChannels;
|
||||
MOZ_ASSERT(numFrames >= 0);
|
||||
MOZ_ASSERT(numSamples >= 0);
|
||||
if (numFrames == 0) {
|
||||
@ -275,10 +276,10 @@ WMFAudioMFTManager::Output(int64_t aStreamOffset, RefPtr<MediaData>& aOutData) {
|
||||
return MF_E_TRANSFORM_NEED_MORE_INPUT;
|
||||
}
|
||||
|
||||
aOutData = new AudioData(aStreamOffset, pts, std::move(audioData),
|
||||
mAudioChannels, mAudioRate, mChannelsMap);
|
||||
MOZ_DIAGNOSTIC_ASSERT(duration == aOutData->mDuration, "must be equal");
|
||||
mLastOutputDuration = aOutData->mDuration;
|
||||
aOutput = new AudioData(aStreamOffset, pts, std::move(audioData),
|
||||
mAudioChannels, mAudioRate, mChannelsMap);
|
||||
MOZ_DIAGNOSTIC_ASSERT(duration == aOutput->mDuration, "must be equal");
|
||||
mLastOutputDuration = aOutput->mDuration;
|
||||
|
||||
#ifdef LOG_SAMPLE_DECODE
|
||||
LOG("Decoded audio sample! timestamp=%lld duration=%lld currentLength=%u",
|
||||
|
@ -177,7 +177,8 @@ Maybe<gfx::YUVColorSpace> GetYUVColorSpace(IMFMediaType* aType) {
|
||||
}
|
||||
|
||||
int32_t MFOffsetToInt32(const MFOffset& aOffset) {
|
||||
return int32_t(aOffset.value + (aOffset.fract / 65536.0f));
|
||||
return AssertedCast<int32_t>(AssertedCast<float>(aOffset.value) +
|
||||
(AssertedCast<float>(aOffset.fract) / 65536.0f));
|
||||
}
|
||||
|
||||
TimeUnit GetSampleDuration(IMFSample* aSample) {
|
||||
@ -204,7 +205,7 @@ GetPictureRegion(IMFMediaType* aMediaType, gfx::IntRect& aOutPictureRegion) {
|
||||
// Determine if "pan and scan" is enabled for this media. If it is, we
|
||||
// only display a region of the video frame, not the entire frame.
|
||||
BOOL panScan =
|
||||
MFGetAttributeUINT32(aMediaType, MF_MT_PAN_SCAN_ENABLED, FALSE);
|
||||
!!MFGetAttributeUINT32(aMediaType, MF_MT_PAN_SCAN_ENABLED, FALSE);
|
||||
|
||||
// If pan and scan mode is enabled. Try to get the display region.
|
||||
HRESULT hr = E_FAIL;
|
||||
@ -300,11 +301,14 @@ const char* MFTMessageTypeToStr(MFT_MESSAGE_TYPE aMsg) {
|
||||
GUID AudioMimeTypeToMediaFoundationSubtype(const nsACString& aMimeType) {
|
||||
if (aMimeType.EqualsLiteral("audio/mpeg")) {
|
||||
return MFAudioFormat_MP3;
|
||||
} else if (MP4Decoder::IsAAC(aMimeType)) {
|
||||
}
|
||||
if (MP4Decoder::IsAAC(aMimeType)) {
|
||||
return MFAudioFormat_AAC;
|
||||
} else if (aMimeType.EqualsLiteral("audio/vorbis")) {
|
||||
}
|
||||
if (aMimeType.EqualsLiteral("audio/vorbis")) {
|
||||
return MFAudioFormat_Vorbis;
|
||||
} else if (aMimeType.EqualsLiteral("audio/opus")) {
|
||||
}
|
||||
if (aMimeType.EqualsLiteral("audio/opus")) {
|
||||
return MFAudioFormat_Opus;
|
||||
}
|
||||
NS_WARNING("Unsupport audio mimetype");
|
||||
@ -314,17 +318,19 @@ GUID AudioMimeTypeToMediaFoundationSubtype(const nsACString& aMimeType) {
|
||||
GUID VideoMimeTypeToMediaFoundationSubtype(const nsACString& aMimeType) {
|
||||
if (MP4Decoder::IsH264(aMimeType)) {
|
||||
return MFVideoFormat_H264;
|
||||
} else if (VPXDecoder::IsVP8(aMimeType)) {
|
||||
}
|
||||
if (VPXDecoder::IsVP8(aMimeType)) {
|
||||
return MFVideoFormat_VP80;
|
||||
} else if (VPXDecoder::IsVP9(aMimeType)) {
|
||||
}
|
||||
if (VPXDecoder::IsVP9(aMimeType)) {
|
||||
return MFVideoFormat_VP90;
|
||||
}
|
||||
#ifdef MOZ_AV1
|
||||
else if (AOMDecoder::IsAV1(aMimeType)) {
|
||||
if (AOMDecoder::IsAV1(aMimeType)) {
|
||||
return MFVideoFormat_AV1;
|
||||
}
|
||||
#endif
|
||||
else if (MP4Decoder::IsHEVC(aMimeType)) {
|
||||
if (MP4Decoder::IsHEVC(aMimeType)) {
|
||||
return MFVideoFormat_HEVC;
|
||||
}
|
||||
NS_WARNING("Unsupport video mimetype");
|
||||
@ -377,10 +383,10 @@ void AACAudioSpecificConfigToUserData(uint8_t aAACProfileLevelIndication,
|
||||
// The AudioSpecificConfig is TTTTTFFF|FCCCCGGG
|
||||
// (T=ObjectType, F=Frequency, C=Channel, G=GASpecificConfig)
|
||||
// If frequency = 0xf, then the frequency is explicitly defined on 24 bits.
|
||||
int8_t frequency =
|
||||
uint8_t frequency =
|
||||
(aAudioSpecConfig[0] & 0x7) << 1 | (aAudioSpecConfig[1] & 0x80) >> 7;
|
||||
int8_t channels = (aAudioSpecConfig[1] & 0x78) >> 3;
|
||||
int8_t gasc = aAudioSpecConfig[1] & 0x7;
|
||||
uint8_t channels = (aAudioSpecConfig[1] & 0x78) >> 3;
|
||||
uint8_t gasc = aAudioSpecConfig[1] & 0x7;
|
||||
if (frequency != 0xf && channels && !gasc) {
|
||||
// We enter this condition if the AudioSpecificConfig should theorically
|
||||
// be 2 bytes long but it's not.
|
||||
|
Loading…
Reference in New Issue
Block a user