зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset d5b8283acbce (bug 1238906) for conflicting with merge down from m-c
This commit is contained in:
Родитель
48c60a840a
Коммит
89b4eb902b
|
@ -54,23 +54,6 @@ AudioData::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
|||
return size;
|
||||
}
|
||||
|
||||
bool
|
||||
AudioData::IsAudible() const
|
||||
{
|
||||
if (!mAudioData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32_t frame = 0; frame < mFrames; ++frame) {
|
||||
for (uint32_t channel = 0; channel < mChannels; ++channel) {
|
||||
if (mAudioData[frame * mChannels + channel] != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<AudioData>
|
||||
AudioData::TransferAndUpdateTimestampAndDuration(AudioData* aOther,
|
||||
|
|
|
@ -149,10 +149,6 @@ public:
|
|||
// If mAudioBuffer is null, creates it from mAudioData.
|
||||
void EnsureAudioBuffer();
|
||||
|
||||
// To check whether mAudioData has audible signal, it's used to distinguish
|
||||
// the audiable data and silent data.
|
||||
bool IsAudible() const;
|
||||
|
||||
const uint32_t mChannels;
|
||||
const uint32_t mRate;
|
||||
// At least one of mAudioBuffer/mAudioData must be non-null.
|
||||
|
|
|
@ -116,11 +116,6 @@ static const int AUDIO_DURATION_USECS = 40000;
|
|||
// increase it by more.
|
||||
static const int THRESHOLD_FACTOR = 2;
|
||||
|
||||
// When the continuous silent data is over this threshold, means the a/v does
|
||||
// not produce any sound. This time is decided by UX suggestion, see
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1235612#c18
|
||||
static const uint32_t SILENT_DATA_THRESHOLD_USECS = 10000000;
|
||||
|
||||
namespace detail {
|
||||
|
||||
// If we have less than this much undecoded data available, we'll consider
|
||||
|
@ -241,8 +236,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
|||
mOutputStreamManager(new OutputStreamManager()),
|
||||
mResource(aDecoder->GetResource()),
|
||||
mAudioOffloading(false),
|
||||
mIsAudioDataAudible(false),
|
||||
mSilentDataDuration(0),
|
||||
mBuffered(mTaskQueue, TimeIntervals(),
|
||||
"MediaDecoderStateMachine::mBuffered (Mirror)"),
|
||||
mEstimatedDuration(mTaskQueue, NullableTimeUnit(),
|
||||
|
@ -716,36 +709,14 @@ MediaDecoderStateMachine::PushFront(MediaData* aSample, MediaData::Type aSampleT
|
|||
UpdateNextFrameStatus();
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::CheckIsAudible(const MediaData* aSample)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
MOZ_ASSERT(aSample->mType == MediaData::AUDIO_DATA);
|
||||
|
||||
const AudioData* data = aSample->As<AudioData>();
|
||||
bool isAudible = data->IsAudible();
|
||||
if (isAudible && !mIsAudioDataAudible) {
|
||||
mIsAudioDataAudible = true;
|
||||
mSilentDataDuration = 0;
|
||||
} else if (isAudible && mIsAudioDataAudible) {
|
||||
mSilentDataDuration += data->mDuration;
|
||||
if (mSilentDataDuration > SILENT_DATA_THRESHOLD_USECS) {
|
||||
mIsAudioDataAudible = false;
|
||||
mSilentDataDuration = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::OnAudioPopped(const RefPtr<MediaData>& aSample)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
|
||||
mPlaybackOffset = std::max(mPlaybackOffset.Ref(), aSample->mOffset);
|
||||
UpdateNextFrameStatus();
|
||||
DispatchAudioDecodeTaskIfNeeded();
|
||||
MaybeStartBuffering();
|
||||
CheckIsAudible(aSample);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -405,7 +405,6 @@ protected:
|
|||
void OnAudioPopped(const RefPtr<MediaData>& aSample);
|
||||
void OnVideoPopped(const RefPtr<MediaData>& aSample);
|
||||
|
||||
void CheckIsAudible(const MediaData* aSample);
|
||||
void VolumeChanged();
|
||||
void LogicalPlaybackRateChanged();
|
||||
void PreservesPitchChanged();
|
||||
|
@ -1196,10 +1195,6 @@ private:
|
|||
// Playback will not start when audio is offloading.
|
||||
bool mAudioOffloading;
|
||||
|
||||
// Used to distiguish continuous silent audio data.
|
||||
bool mIsAudioDataAudible;
|
||||
uint32_t mSilentDataDuration;
|
||||
|
||||
#ifdef MOZ_EME
|
||||
void OnCDMProxyReady(RefPtr<CDMProxy> aProxy);
|
||||
void OnCDMProxyNotReady();
|
||||
|
|
Загрузка…
Ссылка в новой задаче