зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1751023) for causing mochitest failures on test_playback_rate.html.
Backed out changeset 703e7c358f73 (bug 1751023) Backed out changeset 946a654afa04 (bug 1751023)
This commit is contained in:
Родитель
a77ec1c69f
Коммит
566c6f57a1
|
@ -494,7 +494,7 @@ class VideoData : public MediaData {
|
|||
// This frame's image.
|
||||
RefPtr<Image> mImage;
|
||||
|
||||
uint32_t mFrameID;
|
||||
int32_t mFrameID;
|
||||
|
||||
VideoData(int64_t aOffset, const media::TimeUnit& aTime,
|
||||
const media::TimeUnit& aDuration, bool aKeyframe,
|
||||
|
|
|
@ -109,7 +109,7 @@ static constexpr auto AMPLE_AUDIO_THRESHOLD =
|
|||
static const uint32_t LOW_VIDEO_FRAMES = 2;
|
||||
|
||||
// Arbitrary "frame duration" when playing only audio.
|
||||
static const uint32_t AUDIO_DURATION_USECS = 40000;
|
||||
static const int AUDIO_DURATION_USECS = 40000;
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
@ -210,8 +210,7 @@ class MediaDecoderStateMachine::StateObject {
|
|||
virtual void HandleVideoCanceled() { Crash("Unexpected event!", __func__); }
|
||||
virtual void HandleEndOfVideo() { Crash("Unexpected event!", __func__); }
|
||||
|
||||
virtual RefPtr<MediaDecoder::SeekPromise> HandleSeek(
|
||||
const SeekTarget& aTarget);
|
||||
virtual RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget);
|
||||
|
||||
virtual RefPtr<ShutdownPromise> HandleShutdown();
|
||||
|
||||
|
@ -270,7 +269,7 @@ class MediaDecoderStateMachine::StateObject {
|
|||
auto copiedArgs = MakeTuple(std::forward<Ts>(aArgs)...);
|
||||
|
||||
// Copy mMaster which will reset to null.
|
||||
auto* master = mMaster;
|
||||
auto master = mMaster;
|
||||
|
||||
auto* s = new S(master);
|
||||
|
||||
|
@ -343,8 +342,7 @@ class MediaDecoderStateMachine::DecodeMetadataState
|
|||
|
||||
State GetState() const override { return DECODER_STATE_DECODING_METADATA; }
|
||||
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(
|
||||
const SeekTarget& aTarget) override {
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "Can't seek while decoding metadata.");
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(true, __func__);
|
||||
}
|
||||
|
@ -424,8 +422,7 @@ class MediaDecoderStateMachine::DormantState
|
|||
|
||||
State GetState() const override { return DECODER_STATE_DORMANT; }
|
||||
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(
|
||||
const SeekTarget& aTarget) override;
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override;
|
||||
|
||||
void HandleVideoSuspendTimeout() override {
|
||||
// Do nothing since we've released decoders in Enter().
|
||||
|
@ -535,8 +532,7 @@ class MediaDecoderStateMachine::DecodingFirstFrameState
|
|||
MOZ_ASSERT(false, "Shouldn't have suspended video decoding.");
|
||||
}
|
||||
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(
|
||||
const SeekTarget& aTarget) override {
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override {
|
||||
if (mMaster->mIsMSE) {
|
||||
return StateObject::HandleSeek(aTarget);
|
||||
}
|
||||
|
@ -705,9 +701,8 @@ class MediaDecoderStateMachine::DecodingState
|
|||
}
|
||||
|
||||
uint32_t VideoPrerollFrames() const {
|
||||
return std::min(
|
||||
static_cast<uint32_t>(
|
||||
mMaster->GetAmpleVideoFrames() / 2. * mMaster->mPlaybackRate + 1),
|
||||
return std::min<uint32_t>(
|
||||
(mMaster->GetAmpleVideoFrames() / 2) * mMaster->mPlaybackRate + 1,
|
||||
sVideoQueueDefaultSize);
|
||||
}
|
||||
|
||||
|
@ -741,9 +736,7 @@ class MediaDecoderStateMachine::DecodingState
|
|||
if (timeout < 0) {
|
||||
// Disabled when timeout is negative.
|
||||
return;
|
||||
}
|
||||
|
||||
if (timeout == 0) {
|
||||
} else if (timeout == 0) {
|
||||
// Enter dormant immediately without scheduling a timer.
|
||||
SetState<DormantState>();
|
||||
return;
|
||||
|
@ -908,7 +901,7 @@ class MediaDecoderStateMachine::LoopingDecodingState
|
|||
->RequestAudioData()
|
||||
->Then(
|
||||
OwnerThread(), __func__,
|
||||
[this](const RefPtr<AudioData>& aAudio) {
|
||||
[this](RefPtr<AudioData> aAudio) {
|
||||
AUTO_PROFILER_LABEL(
|
||||
"LoopingDecodingState::"
|
||||
"RequestAudioDataFromStartPosition:"
|
||||
|
@ -1097,14 +1090,13 @@ class MediaDecoderStateMachine::SeekingState
|
|||
|
||||
// We specially handle next frame seeks by ignoring them if we're already
|
||||
// seeking.
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(
|
||||
const SeekTarget& aTarget) override {
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override {
|
||||
if (aTarget.IsNextFrame()) {
|
||||
// We ignore next frame seeks if we already have a seek pending
|
||||
SLOG("Already SEEKING, ignoring seekToNextFrame");
|
||||
MOZ_ASSERT(!mSeekJob.mPromise.IsEmpty(), "Seek shouldn't be finished");
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(
|
||||
/* aRejectValue = */ true, __func__);
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true,
|
||||
__func__);
|
||||
}
|
||||
|
||||
return StateObject::HandleSeek(aTarget);
|
||||
|
@ -1899,7 +1891,7 @@ constexpr TimeUnit MediaDecoderStateMachine::VideoOnlySeekingState::
|
|||
sSkipToNextKeyFrameThreshold;
|
||||
|
||||
RefPtr<MediaDecoder::SeekPromise>
|
||||
MediaDecoderStateMachine::DormantState::HandleSeek(const SeekTarget& aTarget) {
|
||||
MediaDecoderStateMachine::DormantState::HandleSeek(SeekTarget aTarget) {
|
||||
if (aTarget.IsNextFrame()) {
|
||||
// NextFrameSeekingState doesn't reset the decoder unlike
|
||||
// AccurateSeekingState. So we first must come out of dormant by seeking to
|
||||
|
@ -2149,8 +2141,7 @@ class MediaDecoderStateMachine::ShutdownState
|
|||
|
||||
State GetState() const override { return DECODER_STATE_SHUTDOWN; }
|
||||
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(
|
||||
const SeekTarget& aTarget) override {
|
||||
RefPtr<MediaDecoder::SeekPromise> HandleSeek(SeekTarget aTarget) override {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "Can't seek in shutdown state.");
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(true, __func__);
|
||||
}
|
||||
|
@ -2170,7 +2161,7 @@ class MediaDecoderStateMachine::ShutdownState
|
|||
};
|
||||
|
||||
RefPtr<MediaDecoder::SeekPromise>
|
||||
MediaDecoderStateMachine::StateObject::HandleSeek(const SeekTarget& aTarget) {
|
||||
MediaDecoderStateMachine::StateObject::HandleSeek(SeekTarget aTarget) {
|
||||
SLOG("Changed state to SEEKING (to %" PRId64 ")",
|
||||
aTarget.GetTime().ToMicroseconds());
|
||||
SeekJob seekJob;
|
||||
|
@ -2216,9 +2207,9 @@ static void ReportRecoveryTelemetry(const TimeStamp& aRecoveryStart,
|
|||
TimeDuration duration = TimeStamp::Now() - aRecoveryStart;
|
||||
double duration_ms = duration.ToMilliseconds();
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_SUSPEND_RECOVERY_TIME_MS, key,
|
||||
static_cast<uint32_t>(lround(duration_ms)));
|
||||
uint32_t(duration_ms + 0.5));
|
||||
Telemetry::Accumulate(Telemetry::VIDEO_SUSPEND_RECOVERY_TIME_MS, "All"_ns,
|
||||
static_cast<uint32_t>(lround(duration_ms)));
|
||||
uint32_t(duration_ms + 0.5));
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::StateObject::HandleResumeVideoDecoding(
|
||||
|
@ -2233,7 +2224,7 @@ void MediaDecoderStateMachine::StateObject::HandleResumeVideoDecoding(
|
|||
TimeStamp start = TimeStamp::Now();
|
||||
|
||||
// Local reference to mInfo, so that it will be copied in the lambda below.
|
||||
const auto& info = Info();
|
||||
auto& info = Info();
|
||||
bool hw = Reader()->VideoIsHardwareAccelerated();
|
||||
|
||||
// Start video-only seek to the current time.
|
||||
|
@ -2683,7 +2674,7 @@ void MediaDecoderStateMachine::BufferingState::HandleEndOfVideo() {
|
|||
|
||||
RefPtr<ShutdownPromise> MediaDecoderStateMachine::ShutdownState::Enter() {
|
||||
PROFILER_MARKER_UNTYPED("MDSM::EnterShutdownState", MEDIA_PLAYBACK);
|
||||
auto* master = mMaster;
|
||||
auto master = mMaster;
|
||||
|
||||
master->mDelayedScheduler.Reset();
|
||||
|
||||
|
@ -2921,8 +2912,7 @@ bool MediaDecoderStateMachine::HaveEnoughDecodedAudio() const {
|
|||
|
||||
bool MediaDecoderStateMachine::HaveEnoughDecodedVideo() const {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
return VideoQueue().GetSize() >=
|
||||
static_cast<size_t>(GetAmpleVideoFrames() * mPlaybackRate + 1) &&
|
||||
return VideoQueue().GetSize() >= GetAmpleVideoFrames() * mPlaybackRate + 1 &&
|
||||
IsVideoDataEnoughComparedWithAudio();
|
||||
}
|
||||
|
||||
|
@ -3262,13 +3252,13 @@ RefPtr<MediaDecoder::SeekPromise> MediaDecoderStateMachine::Seek(
|
|||
// We need to be able to seek in some way
|
||||
if (!mMediaSeekable && !mMediaSeekableOnlyInBufferedRanges) {
|
||||
LOGW("Seek() should not be called on a non-seekable media");
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(/* aRejectValue = */ true,
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true,
|
||||
__func__);
|
||||
}
|
||||
|
||||
if (aTarget.IsNextFrame() && !HasVideo()) {
|
||||
LOGW("Ignore a NextFrameSeekTask on a media file without video track.");
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(/* aRejectValue = */ true,
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(/* aIgnored = */ true,
|
||||
__func__);
|
||||
}
|
||||
|
||||
|
@ -3310,7 +3300,7 @@ void MediaDecoderStateMachine::RequestAudioData() {
|
|||
->Then(
|
||||
OwnerThread(), __func__,
|
||||
[this, self, perfRecorder(std::move(perfRecorder))](
|
||||
const RefPtr<AudioData>& aAudio) mutable {
|
||||
RefPtr<AudioData> aAudio) mutable {
|
||||
perfRecorder.End();
|
||||
AUTO_PROFILER_LABEL(
|
||||
"MediaDecoderStateMachine::RequestAudioData:Resolved",
|
||||
|
@ -3372,7 +3362,7 @@ void MediaDecoderStateMachine::RequestVideoData(
|
|||
->Then(
|
||||
OwnerThread(), __func__,
|
||||
[this, self, perfRecorder(std::move(perfRecorder))](
|
||||
const RefPtr<VideoData>& aVideo) mutable {
|
||||
RefPtr<VideoData> aVideo) mutable {
|
||||
perfRecorder.End();
|
||||
AUTO_PROFILER_LABEL(
|
||||
"MediaDecoderStateMachine::RequestVideoData:Resolved",
|
||||
|
@ -3508,8 +3498,7 @@ bool MediaDecoderStateMachine::HasLowDecodedAudio() {
|
|||
bool MediaDecoderStateMachine::HasLowDecodedVideo() {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
return IsVideoDecoding() &&
|
||||
VideoQueue().GetSize() <
|
||||
static_cast<size_t>(ceill(LOW_VIDEO_FRAMES * mPlaybackRate));
|
||||
VideoQueue().GetSize() < LOW_VIDEO_FRAMES * mPlaybackRate;
|
||||
}
|
||||
|
||||
bool MediaDecoderStateMachine::HasLowDecodedData() {
|
||||
|
@ -3634,7 +3623,7 @@ void MediaDecoderStateMachine::RunStateMachine() {
|
|||
mStateObj->Step();
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::ResetDecode(const TrackSet& aTracks) {
|
||||
void MediaDecoderStateMachine::ResetDecode(TrackSet aTracks) {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
LOG("MediaDecoderStateMachine::Reset");
|
||||
|
||||
|
@ -3708,8 +3697,7 @@ void MediaDecoderStateMachine::UpdatePlaybackPositionPeriodically() {
|
|||
// the monitor and get a staled value from GetCurrentTimeUs() which hits the
|
||||
// assertion in GetClock().
|
||||
|
||||
int64_t delay = std::max<int64_t>(
|
||||
1, static_cast<int64_t>(AUDIO_DURATION_USECS / mPlaybackRate));
|
||||
int64_t delay = std::max<int64_t>(1, AUDIO_DURATION_USECS / mPlaybackRate);
|
||||
ScheduleStateMachineIn(TimeUnit::FromMicroseconds(delay));
|
||||
|
||||
// Notify the listener as we progress in the playback offset. Note it would
|
||||
|
@ -3856,7 +3844,7 @@ void MediaDecoderStateMachine::OutputPrincipalChanged() {
|
|||
}
|
||||
|
||||
RefPtr<GenericPromise> MediaDecoderStateMachine::InvokeSetSink(
|
||||
const RefPtr<AudioDeviceInfo>& aSink) {
|
||||
RefPtr<AudioDeviceInfo> aSink) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aSink);
|
||||
|
||||
|
@ -3865,7 +3853,7 @@ RefPtr<GenericPromise> MediaDecoderStateMachine::InvokeSetSink(
|
|||
}
|
||||
|
||||
RefPtr<GenericPromise> MediaDecoderStateMachine::SetSink(
|
||||
const RefPtr<AudioDeviceInfo>& aDevice) {
|
||||
RefPtr<AudioDeviceInfo> aSinkDevice) {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
if (mIsMediaSinkSuspended) {
|
||||
// Don't change sink id in a suspended sink.
|
||||
|
@ -3877,12 +3865,12 @@ RefPtr<GenericPromise> MediaDecoderStateMachine::SetSink(
|
|||
return GenericPromise::CreateAndReject(NS_ERROR_ABORT, __func__);
|
||||
}
|
||||
|
||||
if (mSinkDevice.Ref() != aDevice) {
|
||||
if (mSinkDevice.Ref() != aSinkDevice) {
|
||||
// A new sink was set before this ran.
|
||||
return GenericPromise::CreateAndResolve(IsPlaying(), __func__);
|
||||
}
|
||||
|
||||
if (mMediaSink->AudioDevice() == aDevice) {
|
||||
if (mMediaSink->AudioDevice() == aSinkDevice) {
|
||||
// The sink has not changed.
|
||||
return GenericPromise::CreateAndResolve(IsPlaying(), __func__);
|
||||
}
|
||||
|
@ -4143,9 +4131,7 @@ const char* MediaDecoderStateMachine::AudioRequestStatus() const {
|
|||
if (IsRequestingAudioData()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsWaitingAudioData());
|
||||
return "pending";
|
||||
}
|
||||
|
||||
if (IsWaitingAudioData()) {
|
||||
} else if (IsWaitingAudioData()) {
|
||||
return "waiting";
|
||||
}
|
||||
return "idle";
|
||||
|
@ -4156,9 +4142,7 @@ const char* MediaDecoderStateMachine::VideoRequestStatus() const {
|
|||
if (IsRequestingVideoData()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsWaitingVideoData());
|
||||
return "pending";
|
||||
}
|
||||
|
||||
if (IsWaitingVideoData()) {
|
||||
} else if (IsWaitingVideoData()) {
|
||||
return "waiting";
|
||||
}
|
||||
return "idle";
|
||||
|
|
|
@ -275,7 +275,7 @@ class MediaDecoderStateMachine
|
|||
// Sets the video decode mode. Used by the suspend-video-decoder feature.
|
||||
void SetVideoDecodeMode(VideoDecodeMode aMode);
|
||||
|
||||
RefPtr<GenericPromise> InvokeSetSink(const RefPtr<AudioDeviceInfo>& aSink);
|
||||
RefPtr<GenericPromise> InvokeSetSink(RefPtr<AudioDeviceInfo> aSink);
|
||||
|
||||
void InvokeSuspendMediaSink();
|
||||
void InvokeResumeMediaSink();
|
||||
|
@ -351,8 +351,8 @@ class MediaDecoderStateMachine
|
|||
|
||||
// Resets all states related to decoding and aborts all pending requests
|
||||
// to the decoders.
|
||||
void ResetDecode(const TrackSet& aTracks = TrackSet(TrackInfo::kAudioTrack,
|
||||
TrackInfo::kVideoTrack));
|
||||
void ResetDecode(TrackSet aTracks = TrackSet(TrackInfo::kAudioTrack,
|
||||
TrackInfo::kVideoTrack));
|
||||
|
||||
void SetVideoDecodeModeInternal(VideoDecodeMode aMode);
|
||||
|
||||
|
@ -364,7 +364,7 @@ class MediaDecoderStateMachine
|
|||
// If there are multiple pending requests only the last one will be
|
||||
// executed, for all previous requests the promise will be resolved
|
||||
// with true or false similar to above.
|
||||
RefPtr<GenericPromise> SetSink(const RefPtr<AudioDeviceInfo>& aDevice);
|
||||
RefPtr<GenericPromise> SetSink(RefPtr<AudioDeviceInfo> aSink);
|
||||
|
||||
// Shutdown MediaSink on suspend to clean up resources.
|
||||
void SuspendMediaSink();
|
||||
|
|
|
@ -77,7 +77,7 @@ dictionary AudioSinkDebugInfo {
|
|||
boolean isPlaying = false;
|
||||
boolean isStarted = false;
|
||||
boolean audioEnded = false;
|
||||
unsigned long outputRate = 0;
|
||||
long outputRate = 0;
|
||||
long long written = 0;
|
||||
boolean hasErrored = false;
|
||||
boolean playbackComplete = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче