Bug 1812375 - Fix static-analysis warnings TimeUnits.h and FFmpegAudioDecoder.cpp. r=media-playback-reviewers,alwu

Differential Revision: https://phabricator.services.mozilla.com/D167914
This commit is contained in:
Paul Adenot 2023-01-30 09:44:12 +00:00
Родитель 8e5521d76b
Коммит f284e71d53
2 изменённых файлов: 17 добавлений и 15 удалений

Просмотреть файл

@ -22,8 +22,8 @@ class TimeIntervals;
// CopyChooser specialization for nsTArray
template <>
struct nsTArray_RelocationStrategy<mozilla::media::TimeIntervals> {
typedef nsTArray_RelocateUsingMoveConstructor<mozilla::media::TimeIntervals>
Type;
using Type =
nsTArray_RelocateUsingMoveConstructor<mozilla::media::TimeIntervals>;
};
namespace mozilla {
@ -40,13 +40,13 @@ namespace media {
static const int64_t NSECS_PER_S = 1000000000;
#ifndef PROCESS_DECODE_LOG
# define PROCESS_DECODE_LOG(sample) \
MOZ_LOG( \
sPDMLog, mozilla::LogLevel::Verbose, \
("ProcessDecode: mDuration=%" PRIu64 "µs ; mTime=%" PRIu64 \
"µs ; mTimecode=%" PRIu64 "µs", \
sample->mDuration.ToMicroseconds(), sample->mTime.ToMicroseconds(), \
sample->mTimecode.ToMicroseconds()))
# define PROCESS_DECODE_LOG(sample) \
MOZ_LOG(sPDMLog, mozilla::LogLevel::Verbose, \
("ProcessDecode: mDuration=%" PRIu64 "µs ; mTime=%" PRIu64 \
"µs ; mTimecode=%" PRIu64 "µs", \
(sample)->mDuration.ToMicroseconds(), \
(sample)->mTime.ToMicroseconds(), \
(sample)->mTimecode.ToMicroseconds()))
#endif // PROCESS_DECODE_LOG
// TimeUnit at present uses a CheckedInt64 as storage.
@ -66,11 +66,11 @@ class TimeUnit final {
(aValue <= 0 ? aValue - halfUsec : aValue + halfUsec) * USECS_PER_S;
if (val >= double(INT64_MAX)) {
return FromMicroseconds(INT64_MAX);
} else if (val <= double(INT64_MIN)) {
return FromMicroseconds(INT64_MIN);
} else {
return FromMicroseconds(int64_t(val));
}
if (val <= double(INT64_MIN)) {
return FromMicroseconds(INT64_MIN);
}
return FromMicroseconds(int64_t(val));
}
static constexpr TimeUnit FromMicroseconds(int64_t aValue) {

Просмотреть файл

@ -438,9 +438,11 @@ AVCodecID FFmpegAudioDecoder<LIBAV_VER>::GetCodecId(
}
#endif
return AV_CODEC_ID_MP3;
} else if (aMimeType.EqualsLiteral("audio/flac")) {
}
if (aMimeType.EqualsLiteral("audio/flac")) {
return AV_CODEC_ID_FLAC;
} else if (aMimeType.EqualsLiteral("audio/mp4a-latm")) {
}
if (aMimeType.EqualsLiteral("audio/mp4a-latm")) {
return AV_CODEC_ID_AAC;
}