Bug 1235612 - part4 : modify check audible method.
MozReview-Commit-ID: FvCrbdkNSll
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -117,21 +117,16 @@ static const int32_t LOW_VIDEO_THRESHOLD
static const int AUDIO_DURATION_USECS = 40000;
// If we increase our "low audio threshold" (see LOW_AUDIO_USECS above), we
// use this as a factor in all our calculations. Increasing this will cause
// us to be more likely to increase our low audio threshold, and to
// 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
// ourselves to be running low on undecoded data. We determine how much
// undecoded data we have remaining using the reader's GetBuffered()
// implementation.
static const int64_t LOW_DATA_THRESHOLD_USECS = 5000000;
@@ -242,17 +237,16 @@ MediaDecoderStateMachine::MediaDecoderSt
mDecodeThreadWaiting(false),
mDecodingFirstFrame(true),
mSentLoadedMetadataEvent(false),
mSentFirstFrameLoadedEvent(false),
mSentPlaybackEndedEvent(false),
mOutputStreamManager(new OutputStreamManager()),
mResource(aDecoder->GetResource()),
mAudioOffloading(false),
- mSilentDataDuration(0),
mBuffered(mTaskQueue, TimeIntervals(),
"MediaDecoderStateMachine::mBuffered (Mirror)"),
mEstimatedDuration(mTaskQueue, NullableTimeUnit(),
"MediaDecoderStateMachine::mEstimatedDuration (Mirror)"),
mExplicitDuration(mTaskQueue, Maybe<double>(),
"MediaDecoderStateMachine::mExplicitDuration (Mirror)"),
mPlayState(mTaskQueue, MediaDecoder::PLAY_STATE_LOADING,
"MediaDecoderStateMachine::mPlayState (Mirror)"),
@@ -626,23 +620,18 @@ MediaDecoderStateMachine::CheckIsAudible
{
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;
- }
+ } else if (!isAudible && mIsAudioDataAudible) {
+ mIsAudioDataAudible = false;
}
}
void
MediaDecoderStateMachine::OnAudioPopped(const RefPtr<MediaData>& aSample)
{
MOZ_ASSERT(OnTaskQueue());
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -949,19 +949,16 @@ private:
MediaEventProducer<MediaEventType> mOnPlaybackEvent;
MediaEventProducer<MediaDecoderEventVisibility> mOnSeekingStart;
// True if audio is offloading.
// Playback will not start when audio is offloading.
bool mAudioOffloading;
- // Duration of the continuous silent data.
- uint32_t mSilentDataDuration;
-
#ifdef MOZ_EME
void OnCDMProxyReady(RefPtr<CDMProxy> aProxy);
void OnCDMProxyNotReady();
RefPtr<CDMProxy> mCDMProxy;
MozPromiseRequestHolder<MediaDecoder::CDMProxyPromise> mCDMProxyPromise;
#endif
private: