зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1659244 - Remove audibility code from AudioSegment and AudioBlock. r=pehrsons
Same rationale as for AudioData, the audibility is best computed externally. Differential Revision: https://phabricator.services.mozilla.com/D90432
This commit is contained in:
Родитель
55b9625c87
Коммит
718b5288e8
|
@ -208,23 +208,6 @@ struct AudioChunk {
|
|||
|
||||
bool IsMuted() const { return mVolume == 0.0f; }
|
||||
|
||||
bool IsAudible() const {
|
||||
for (auto&& channel : mChannelData) {
|
||||
// Transform sound into dB RMS and assume that the value smaller than -100
|
||||
// is inaudible.
|
||||
float dbrms = 0.0;
|
||||
for (uint32_t idx = 0; idx < mDuration; idx++) {
|
||||
dbrms += std::pow(static_cast<const AudioDataValue*>(channel)[idx], 2);
|
||||
}
|
||||
dbrms /= mDuration;
|
||||
dbrms = std::sqrt(dbrms) != 0.0 ? 20 * log10(dbrms) : -1000.0;
|
||||
if (dbrms > -100.0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t SizeOfExcludingThisIfUnshared(MallocSizeOf aMallocSizeOf) const {
|
||||
return SizeOfExcludingThis(aMallocSizeOf, true);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ class AudioBlock : private AudioChunk {
|
|||
using AudioChunk::ChannelCount;
|
||||
using AudioChunk::ChannelData;
|
||||
using AudioChunk::GetDuration;
|
||||
using AudioChunk::IsAudible;
|
||||
using AudioChunk::IsNull;
|
||||
using AudioChunk::SizeOfExcludingThis;
|
||||
using AudioChunk::SizeOfExcludingThisIfUnshared;
|
||||
|
|
Загрузка…
Ссылка в новой задаче