commit a8abdd1ff4601bcf54e8bccd7b34d6038b46f94c
parent cc7610a13af29c341d86f6fbec3c2d6eebd5b920
Author: Karl Tomlinson <karlt+@karlt.net>
Date: Fri, 2 Jan 2026 09:12:54 +0000
Bug 2006276 Revert DecodedStream position interpolation and dependent changesets r=media-playback-reviewers,webidl,smaug,aosmond
due to skips and freezes when resuming after playback pause.
Revert "Bug 1931328 - Account for playback rate when setting frame timestamps in DecodedStream. r=padenot"
This reverts commit 5df6a99098033eac5a05134437d4393200c8652b.
Revert "Bug 1931328 - Test the interpolated GetPosition in DecodedStream. r=padenot"
This reverts commit a8c2ffa3f7c13ce6533bc06c5bbe7ecb0bc7f90f.
Revert "Bug 1931328 - Allow for deterministic output time testing of DecodedStream. r=padenot"
This reverts commit 1a970ccb483397c434bd9f2a3d566d72b2444c82.
Revert "Bug 1931328 - Interpolate DecodedStream position based on current system time. r=padenot,webidl,smaug"
This reverts commit 6bc5f33ade36f71c360721f04c77744d662ace1b.
Differential Revision: https://phabricator.services.mozilla.com/D277683
Diffstat:
6 files changed, 31 insertions(+), 281 deletions(-)
diff --git a/dom/media/gtest/TestDecodedStream.cpp b/dom/media/gtest/TestDecodedStream.cpp
@@ -6,22 +6,16 @@
#include "BlankDecoderModule.h"
#include "DecodedStream.h"
-#include "ImageContainer.h"
#include "MediaData.h"
#include "MediaQueue.h"
#include "MediaTrackGraphImpl.h"
#include "MediaTrackListener.h"
#include "MockCubeb.h"
-#include "VideoSegment.h"
-#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "mozilla/gtest/WaitFor.h"
#include "nsJSEnvironment.h"
-using mozilla::layers::ImageContainer;
-using mozilla::layers::ImageUsageType;
using mozilla::media::TimeUnit;
-using testing::ElementsAre;
using testing::Test;
namespace mozilla {
@@ -77,36 +71,6 @@ class OnFallbackListener : public MediaTrackListener {
}
};
-template <typename Segment>
-class CapturingListener : public MediaTrackListener {
- public:
- Segment mSegment;
-
- void NotifyQueuedChanges(MediaTrackGraph* aGraph, TrackTime aTrackOffset,
- const MediaSegment& aQueuedMedia) {
- mSegment.AppendSlice(aQueuedMedia, 0, aQueuedMedia.GetDuration());
- }
-};
-
-class TestableDecodedStream : public DecodedStream {
- public:
- TestableDecodedStream(
- AbstractThread* aOwnerThread,
- nsMainThreadPtrHandle<SharedDummyTrack> aDummyTrack,
- CopyableTArray<RefPtr<ProcessedMediaTrack>> aOutputTracks,
- AbstractCanonical<PrincipalHandle>* aCanonicalOutputPrincipal,
- double aVolume, double aPlaybackRate, bool aPreservesPitch,
- MediaQueue<AudioData>& aAudioQueue, MediaQueue<VideoData>& aVideoQueue)
- : DecodedStream(aOwnerThread, std::move(aDummyTrack),
- std::move(aOutputTracks), aCanonicalOutputPrincipal,
- aVolume, aPlaybackRate, aPreservesPitch, aAudioQueue,
- aVideoQueue) {}
-
- using DecodedStream::GetPositionImpl;
- using DecodedStream::LastOutputSystemTime;
- using DecodedStream::LastVideoTimeStamp;
-};
-
template <MediaType Type>
class TestDecodedStream : public Test {
public:
@@ -120,7 +84,7 @@ class TestDecodedStream : public Test {
nsMainThreadPtrHandle<SharedDummyTrack> mDummyTrack;
CopyableTArray<RefPtr<ProcessedMediaTrack>> mOutputTracks;
Canonical<PrincipalHandle> mCanonicalOutputPrincipal;
- RefPtr<TestableDecodedStream> mDecodedStream;
+ RefPtr<DecodedStream> mDecodedStream;
TestDecodedStream()
: mMockCubeb(MakeRefPtr<MockCubeb>(MockCubeb::RunningMode::Manual)),
@@ -134,7 +98,7 @@ class TestDecodedStream : public Test {
mCanonicalOutputPrincipal(
AbstractThread::GetCurrent(), PRINCIPAL_HANDLE_NONE,
"TestDecodedStream::mCanonicalOutputPrincipal"),
- mDecodedStream(MakeRefPtr<TestableDecodedStream>(
+ mDecodedStream(MakeRefPtr<DecodedStream>(
AbstractThread::GetCurrent(), mDummyTrack, mOutputTracks,
&mCanonicalOutputPrincipal, /* aVolume = */ 1.0,
/* aPlaybackRate = */ 1.0,
@@ -220,8 +184,6 @@ class TestDecodedStream : public Test {
}
MediaInfo CreateMediaInfo() { return mozilla::CreateMediaInfo<Type>(); }
-
- void TestVideoTimestampsWithPlaybackRate(double aPlaybackRate);
};
using TestDecodedStreamA = TestDecodedStream<Audio>;
@@ -233,150 +195,4 @@ TEST_F(TestDecodedStreamAV, StartStop) {
mDecodedStream->SetPlaying(true);
mDecodedStream->Stop();
}
-
-TEST_F(TestDecodedStreamA, LastOutputSystemTime) {
- auto start = AwakeTimeStamp::Now();
- BlankAudioDataCreator creator(2, kRate);
- auto raw = MakeRefPtr<MediaRawData>();
- raw->mDuration = TimeUnit(kRate, kRate);
- mAudioQueue.Push(RefPtr(creator.Create(raw))->As<AudioData>());
-
- mDecodedStream->Start(TimeUnit::Zero(), CreateMediaInfo());
- mDecodedStream->SetPlaying(true);
- NS_ProcessPendingEvents(nullptr);
- mMockCubebStream->ManualDataCallback(0);
-
- auto before = AwakeTimeStamp::Now();
- // This runs the events on the graph thread, sampling the system clock.
- mMockCubebStream->ManualDataCallback(512);
- auto after = AwakeTimeStamp::Now();
- // This runs the event handlers on the MDSM thread, updating the timestamps.
- NS_ProcessPendingEvents(nullptr);
- EXPECT_GE(mDecodedStream->LastOutputSystemTime() - start, before - start);
- EXPECT_LE(mDecodedStream->LastOutputSystemTime() - start, after - start);
-
- mDecodedStream->Stop();
-}
-
-TEST_F(TestDecodedStreamA, InterpolatedPosition) {
- BlankAudioDataCreator creator(2, kRate);
- auto raw = MakeRefPtr<MediaRawData>();
- raw->mDuration = TimeUnit(kRate, kRate);
- mAudioQueue.Push(RefPtr(creator.Create(raw))->As<AudioData>());
-
- mDecodedStream->Start(TimeUnit::Zero(), CreateMediaInfo());
- mDecodedStream->SetPlaying(true);
- NS_ProcessPendingEvents(nullptr);
- mMockCubebStream->ManualDataCallback(0);
-
- auto now = TimeStamp::Now();
- auto awakeNow = AwakeTimeStamp::Now();
- TimeStamp outNow;
- TimeUnit pos = mDecodedStream->GetPositionImpl(now, awakeNow, &outNow);
- EXPECT_EQ(now, outNow);
- EXPECT_EQ(pos, TimeUnit::Zero()) << pos.ToMilliseconds();
-
- mMockCubebStream->ManualDataCallback(512);
- NS_ProcessPendingEvents(nullptr);
-
- now += TimeDuration::FromSeconds(
- (mDecodedStream->LastOutputSystemTime() - awakeNow).ToSeconds());
- awakeNow = mDecodedStream->LastOutputSystemTime();
- pos = mDecodedStream->GetPositionImpl(now, awakeNow);
- EXPECT_EQ(pos.ToMicroseconds(), TimeUnit(512, kRate).ToMicroseconds());
-
- // Check that the position is interpolated based on wall clock time since last
- // output notification.
- now += TimeDuration::FromSeconds(
- (mDecodedStream->LastOutputSystemTime() - awakeNow).ToSeconds()) +
- TimeDuration::FromMilliseconds(10);
- awakeNow = mDecodedStream->LastOutputSystemTime() +
- AwakeTimeDuration::FromMilliseconds(10);
- pos = mDecodedStream->GetPositionImpl(now, awakeNow);
- EXPECT_EQ(pos.ToMicroseconds(),
- (TimeUnit(512, kRate) + TimeUnit(10, 1000)).ToMicroseconds());
-
- mDecodedStream->Stop();
-}
-
-template <MediaType Type>
-void TestDecodedStream<Type>::TestVideoTimestampsWithPlaybackRate(
- double aPlaybackRate) {
- static_assert(Type == MediaType::Video);
-
- auto imageContainer = MakeRefPtr<ImageContainer>(ImageUsageType::Webrtc,
- ImageContainer::SYNCHRONOUS);
- // Capture the output into a dedicated segment, that the graph will not prune
- // like it will for the output track's mSegment.
- RefPtr capturingListener = new CapturingListener<VideoSegment>();
- mOutputTracks[0]->AddListener(capturingListener);
- VideoSegment* segment = &capturingListener->mSegment;
-
- {
- // Add 4 video frames a 100ms each. Later we'll check timestamps of 3. We
- // add 4 here to make the 3rd frames duration deterministic.
- BlankVideoDataCreator creator(640, 480, imageContainer);
- TimeUnit t = TimeUnit::Zero();
- for (size_t i = 0; i < 4; ++i) {
- constexpr TimeUnit kDuration = TimeUnit(kRate / 10, kRate);
- auto raw = MakeRefPtr<MediaRawData>();
- raw->mTime = t;
- raw->mDuration = kDuration;
- t += kDuration;
- mVideoQueue.Push(RefPtr(creator.Create(raw))->template As<VideoData>());
- }
- }
-
- mDecodedStream->SetPlaybackRate(aPlaybackRate);
- mDecodedStream->Start(TimeUnit::Zero(), CreateMediaInfo());
- mDecodedStream->SetPlaying(true);
- NS_ProcessPendingEvents(nullptr);
- mMockCubebStream->ManualDataCallback(0);
-
- // Advance time enough to extract all 3 video frames.
- long duration = 0;
- while (duration < static_cast<long>((static_cast<double>(kRate) / 10) * 3 /
- aPlaybackRate)) {
- constexpr long kChunk = 512;
- mMockCubebStream->ManualDataCallback(kChunk);
- NS_ProcessPendingEvents(nullptr);
- duration += kChunk;
- }
- EXPECT_EQ(segment->GetDuration(), duration);
-
- // Calculate the expected timestamp of the first frame. At this point all
- // frames in the VideoQueue have been sent, so LastVideoTimeStamp() matches
- // the timestamp of frame 4.
- const auto frameGap =
- TimeDuration::FromMilliseconds(100).MultDouble(1 / aPlaybackRate);
- TimeStamp videoStartOffset =
- mDecodedStream->LastVideoTimeStamp() - frameGap * 3;
-
- // Check durations of the first 3 frames.
- AutoTArray<TrackTime, 3> durations;
- AutoTArray<TimeDuration, 3> timestamps;
- for (VideoSegment::ConstChunkIterator i(*segment);
- durations.Length() < 3 && !i.IsEnded(); i.Next()) {
- durations.AppendElement(i->GetDuration());
- timestamps.AppendElement(i->mTimeStamp - videoStartOffset);
- }
- const TrackTime d =
- static_cast<TrackTime>(static_cast<double>(kRate) / 10 / aPlaybackRate);
- EXPECT_THAT(durations, ElementsAre(d, d, d));
- EXPECT_THAT(timestamps,
- ElementsAre(frameGap * 0, frameGap * 1, frameGap * 2));
-
- mOutputTracks[0]->RemoveListener(capturingListener);
- mDecodedStream->Stop();
-}
-
-TEST_F(TestDecodedStreamV, VideoTimeStamps) {
- TestVideoTimestampsWithPlaybackRate(1.0);
-}
-TEST_F(TestDecodedStreamV, VideoTimeStampsFaster) {
- TestVideoTimestampsWithPlaybackRate(2.0);
-}
-TEST_F(TestDecodedStreamV, VideoTimeStampsSlower) {
- TestVideoTimestampsWithPlaybackRate(0.5);
-}
} // namespace mozilla
diff --git a/dom/media/mediasink/AudioDecoderInputTrack.cpp b/dom/media/mediasink/AudioDecoderInputTrack.cpp
@@ -597,7 +597,7 @@ void AudioDecoderInputTrack::NotifyInTheEndOfProcessInput(
LOG("Notify, fill=%" PRId64 ", total written=%" PRId64 ", ended=%d",
aFillDuration, mWrittenFrames, Ended());
if (aFillDuration > 0) {
- mOnOutput.Notify(mWrittenFrames, TimeStamp::Now(), AwakeTimeStamp::Now());
+ mOnOutput.Notify(mWrittenFrames);
}
if (Ended()) {
mOnEnd.Notify();
diff --git a/dom/media/mediasink/AudioDecoderInputTrack.h b/dom/media/mediasink/AudioDecoderInputTrack.h
@@ -12,6 +12,7 @@
#include "MediaTrackGraph.h"
#include "TimeUnits.h"
#include "mozilla/SPSCQueue.h"
+#include "mozilla/StateMirroring.h"
#include "mozilla/TimeStamp.h"
#include "nsISerialEventTarget.h"
@@ -100,9 +101,7 @@ class AudioDecoderInputTrack final : public ProcessedMediaTrack {
void Close();
bool HasBatchedData() const;
- MediaEventSource<int64_t, TimeStamp, AwakeTimeStamp>& OnOutput() {
- return mOnOutput;
- }
+ MediaEventSource<int64_t>& OnOutput() { return mOnOutput; }
MediaEventSource<void>& OnEnd() { return mOnEnd; }
// Graph Thread API
@@ -177,9 +176,8 @@ class AudioDecoderInputTrack final : public ProcessedMediaTrack {
const RefPtr<nsISerialEventTarget> mDecoderThread;
- // Notify the amount of audio frames which have been sent to the track,
- // sampled by the awake system time (and non-awake, for now) they were sent.
- MediaEventProducer<int64_t, TimeStamp, AwakeTimeStamp> mOnOutput;
+ // Notify the amount of audio frames which have been sent to the track.
+ MediaEventProducer<int64_t> mOnOutput;
// Notify when the track is ended.
MediaEventProducer<void> mOnEnd;
diff --git a/dom/media/mediasink/DecodedStream.cpp b/dom/media/mediasink/DecodedStream.cpp
@@ -101,11 +101,9 @@ class DecodedStreamGraphListener {
void RegisterListeners() {
if (mAudioTrack) {
mOnAudioOutput = mAudioTrack->OnOutput().Connect(
- mDecoderThread, [self = RefPtr<DecodedStreamGraphListener>(this)](
- TrackTime aTime, TimeStamp aSystemTime,
- AwakeTimeStamp aAwakeSystemTime) {
- self->NotifyOutput(MediaSegment::AUDIO, aTime, aSystemTime,
- aAwakeSystemTime);
+ mDecoderThread,
+ [self = RefPtr<DecodedStreamGraphListener>(this)](TrackTime aTime) {
+ self->NotifyOutput(MediaSegment::AUDIO, aTime);
});
mOnAudioEnd = mAudioTrack->OnEnd().Connect(
mDecoderThread, [self = RefPtr<DecodedStreamGraphListener>(this)]() {
@@ -146,8 +144,7 @@ class DecodedStreamGraphListener {
mOnAudioEnd.DisconnectIfExists();
}
- void NotifyOutput(MediaSegment::Type aType, TrackTime aCurrentTrackTime,
- TimeStamp aSystemTime, AwakeTimeStamp aAwakeSystemTime) {
+ void NotifyOutput(MediaSegment::Type aType, TrackTime aCurrentTrackTime) {
AssertOnDecoderThread();
if (aType == MediaSegment::AUDIO) {
mAudioOutputFrames = aCurrentTrackTime;
@@ -181,8 +178,7 @@ class DecodedStreamGraphListener {
const MediaTrack* track = aType == MediaSegment::VIDEO
? static_cast<MediaTrack*>(mVideoTrack)
: static_cast<MediaTrack*>(mAudioTrack);
- mOnOutput.Notify(track->TrackTimeToMicroseconds(aCurrentTrackTime),
- aSystemTime, aAwakeSystemTime);
+ mOnOutput.Notify(track->TrackTimeToMicroseconds(aCurrentTrackTime));
}
void NotifyEnded(MediaSegment::Type aType) {
@@ -238,9 +234,7 @@ class DecodedStreamGraphListener {
return mAudioOutputFrames;
}
- MediaEventSource<int64_t, TimeStamp, AwakeTimeStamp>& OnOutput() {
- return mOnOutput;
- }
+ MediaEventSource<int64_t>& OnOutput() { return mOnOutput; }
private:
~DecodedStreamGraphListener() {
@@ -255,7 +249,7 @@ class DecodedStreamGraphListener {
const RefPtr<nsISerialEventTarget> mDecoderThread;
// Accessible on any thread, but only notify on the decoder thread.
- MediaEventProducer<int64_t, TimeStamp, AwakeTimeStamp> mOnOutput;
+ MediaEventProducer<int64_t> mOnOutput;
RefPtr<SourceVideoTrackListener> mVideoTrackListener;
@@ -302,12 +296,9 @@ void SourceVideoTrackListener::NotifyOutput(MediaTrackGraph* aGraph,
mLastVideoOutputTime = aCurrentTrackTime;
mDecoderThread->Dispatch(NS_NewRunnableFunction(
"SourceVideoTrackListener::NotifyOutput",
- [self = RefPtr<SourceVideoTrackListener>(this), aCurrentTrackTime,
- systemTime = TimeStamp::Now(),
- awakeSystemTime = AwakeTimeStamp::Now()]() {
+ [self = RefPtr<SourceVideoTrackListener>(this), aCurrentTrackTime]() {
self->mGraphListener->NotifyOutput(MediaSegment::VIDEO,
- aCurrentTrackTime, systemTime,
- awakeSystemTime);
+ aCurrentTrackTime);
}));
}
@@ -339,7 +330,7 @@ class DecodedStreamData final {
float aPlaybackRate, float aVolume, bool aPreservesPitch,
nsISerialEventTarget* aDecoderThread);
~DecodedStreamData();
- MediaEventSource<int64_t, TimeStamp, AwakeTimeStamp>& OnOutput();
+ MediaEventSource<int64_t>& OnOutput();
// This is used to mark track as closed and should be called before Forget().
// Decoder thread only.
void Close();
@@ -449,8 +440,7 @@ DecodedStreamData::~DecodedStreamData() {
}
}
-MediaEventSource<int64_t, TimeStamp, AwakeTimeStamp>&
-DecodedStreamData::OnOutput() {
+MediaEventSource<int64_t>& DecodedStreamData::OnOutput() {
return mListener->OnOutput();
}
@@ -516,7 +506,6 @@ nsresult DecodedStream::Start(const TimeUnit& aStartTime,
const MediaInfo& aInfo) {
AssertOwnerThread();
MOZ_ASSERT(mStartTime.isNothing(), "playback already started.");
- MOZ_ASSERT(mLastReportedPosition.isNothing());
AUTO_PROFILER_LABEL(FUNCTION_SIGNATURE, MEDIA_PLAYBACK);
if (profiler_thread_is_being_profiled_for_markers()) {
@@ -529,7 +518,6 @@ nsresult DecodedStream::Start(const TimeUnit& aStartTime,
mStartTime.emplace(aStartTime);
mLastOutputTime = TimeUnit::Zero();
- mLastOutputSystemTime = Nothing();
mInfo = aInfo;
mPlaying = true;
mPrincipalHandle.Connect(mCanonicalOutputPrincipal);
@@ -645,7 +633,6 @@ void DecodedStream::Stop() {
ResetVideo(mPrincipalHandle);
ResetAudio();
mStartTime.reset();
- mLastReportedPosition = Nothing();
mAudioEndedPromise = nullptr;
mVideoEndedPromise = nullptr;
@@ -994,10 +981,9 @@ void DecodedStream::SendVideo(const PrincipalHandle& aPrincipalHandle) {
// video frame). E.g. if we have a video frame that is 30 sec long
// and capture happens at 15 sec, we'll have to append a black frame
// that is 15 sec long.
- TimeStamp t = std::max(mData->mLastVideoTimeStamp,
- currentTime + (lastEnd - currentPosition)
- .ToTimeDuration()
- .MultDouble(1 / mPlaybackRate));
+ TimeStamp t =
+ std::max(mData->mLastVideoTimeStamp,
+ currentTime + (lastEnd - currentPosition).ToTimeDuration());
mData->WriteVideoToSegment(mData->mLastVideoImage, lastEnd, v->mTime,
mData->mLastVideoImageDisplaySize, t, &output,
aPrincipalHandle, mPlaybackRate);
@@ -1009,10 +995,9 @@ void DecodedStream::SendVideo(const PrincipalHandle& aPrincipalHandle) {
// before the last frame's end time for some videos. This only matters for
// the track's lifetime in the MTG, as rendering is based on timestamps,
// aka frame start times.
- TimeStamp t = std::max(mData->mLastVideoTimeStamp,
- currentTime + (lastEnd - currentPosition)
- .ToTimeDuration()
- .MultDouble(1 / mPlaybackRate));
+ TimeStamp t =
+ std::max(mData->mLastVideoTimeStamp,
+ currentTime + (lastEnd - currentPosition).ToTimeDuration());
TimeUnit end = std::max(
v->GetEndTime(),
lastEnd + TimeUnit::FromMicroseconds(
@@ -1113,47 +1098,16 @@ TimeUnit DecodedStream::GetEndTime(TrackType aType) const {
TimeUnit DecodedStream::GetPosition(TimeStamp* aTimeStamp) {
AssertOwnerThread();
TRACE("DecodedStream::GetPosition");
- return GetPositionImpl(TimeStamp::Now(), AwakeTimeStamp::Now(), aTimeStamp);
-}
-
-TimeUnit DecodedStream::GetPositionImpl(TimeStamp aNow,
- AwakeTimeStamp aAwakeNow,
- TimeStamp* aTimeStamp) {
- AssertOwnerThread();
// This is only called after MDSM starts playback. So mStartTime is
// guaranteed to be something.
MOZ_ASSERT(mStartTime.isSome());
if (aTimeStamp) {
- *aTimeStamp = aNow;
- }
- AwakeTimeDuration timeSinceLastOutput;
- if (mLastOutputSystemTime) {
- MOZ_ASSERT(aAwakeNow >= *mLastOutputSystemTime);
- timeSinceLastOutput = aAwakeNow - *mLastOutputSystemTime;
- }
- TimeUnit position = mStartTime.ref() + mLastOutputTime +
- TimeUnit::FromSeconds(timeSinceLastOutput.ToSeconds());
- if (mLastReportedPosition && position < *mLastReportedPosition) {
- // There's a theoretical risk of time going backwards because of the
- // interpolation based on mLastOutputSystemTime. Prevent that here.
- position = *mLastReportedPosition;
- }
- mLastReportedPosition = Some(position);
- return position;
-}
-
-AwakeTimeStamp DecodedStream::LastOutputSystemTime() const {
- AssertOwnerThread();
- return *mLastOutputSystemTime;
-}
-
-TimeStamp DecodedStream::LastVideoTimeStamp() const {
- AssertOwnerThread();
- return mData->mLastVideoTimeStamp;
+ *aTimeStamp = TimeStamp::Now();
+ }
+ return mStartTime.ref() + mLastOutputTime;
}
-void DecodedStream::NotifyOutput(int64_t aTime, TimeStamp aSystemTime,
- AwakeTimeStamp aAwakeSystemTime) {
+void DecodedStream::NotifyOutput(int64_t aTime) {
AssertOwnerThread();
TimeUnit time = TimeUnit::FromMicroseconds(aTime);
if (time == mLastOutputTime) {
@@ -1161,10 +1115,7 @@ void DecodedStream::NotifyOutput(int64_t aTime, TimeStamp aSystemTime,
}
MOZ_ASSERT(mLastOutputTime < time);
mLastOutputTime = time;
- MOZ_ASSERT_IF(mLastOutputSystemTime,
- *mLastOutputSystemTime < aAwakeSystemTime);
- mLastOutputSystemTime = Some(aAwakeSystemTime);
- auto currentTime = GetPositionImpl(aSystemTime, aAwakeSystemTime);
+ auto currentTime = GetPosition();
if (profiler_thread_is_being_profiled_for_markers()) {
nsPrintfCString markerString("OutputTime=%" PRId64,
@@ -1226,10 +1177,6 @@ void DecodedStream::GetDebugInfo(dom::MediaSinkDebugInfo& aInfo) {
NS_ConvertUTF8toUTF16(nsPrintfCString("%p", this));
aInfo.mDecodedStream.mStartTime = startTime;
aInfo.mDecodedStream.mLastOutputTime = mLastOutputTime.ToMicroseconds();
- aInfo.mDecodedStream.mLastReportedPosition =
- mLastReportedPosition
- .map([](const auto& aT) { return aT.ToMicroseconds(); })
- .valueOr(0);
aInfo.mDecodedStream.mPlaying = mPlaying.Ref();
auto lastAudio = mAudioQueue.PeekBack();
aInfo.mDecodedStream.mLastAudio =
diff --git a/dom/media/mediasink/DecodedStream.h b/dom/media/mediasink/DecodedStream.h
@@ -12,12 +12,10 @@
#include "MediaInfo.h"
#include "MediaSink.h"
#include "mozilla/AbstractThread.h"
-#include "mozilla/AwakeTimeStamp.h"
#include "mozilla/Maybe.h"
#include "mozilla/MozPromise.h"
#include "mozilla/RefPtr.h"
#include "mozilla/StateMirroring.h"
-#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
namespace mozilla {
@@ -29,6 +27,7 @@ class VideoData;
struct PlaybackInfoInit;
class ProcessedMediaTrack;
struct SharedDummyTrack;
+class TimeStamp;
template <class T>
class MediaQueue;
@@ -78,12 +77,6 @@ class DecodedStream : public MediaSink {
protected:
virtual ~DecodedStream();
- // A bit many clocks to sample, but what do you do...
- media::TimeUnit GetPositionImpl(TimeStamp aNow, AwakeTimeStamp aAwakeNow,
- TimeStamp* aTimeStamp = nullptr);
- AwakeTimeStamp LastOutputSystemTime() const;
- TimeStamp LastVideoTimeStamp() const;
-
private:
void DestroyData(UniquePtr<DecodedStreamData>&& aData);
void SendAudio(const PrincipalHandle& aPrincipalHandle);
@@ -91,8 +84,7 @@ class DecodedStream : public MediaSink {
void ResetAudio();
void ResetVideo(const PrincipalHandle& aPrincipalHandle);
void SendData();
- void NotifyOutput(int64_t aTime, TimeStamp aSystemTime,
- AwakeTimeStamp aAwakeSystemTime);
+ void NotifyOutput(int64_t aTime);
void CheckIsDataAudible(const AudioData* aData);
void AssertOwnerThread() const {
@@ -135,8 +127,6 @@ class DecodedStream : public MediaSink {
media::NullableTimeUnit mStartTime;
media::TimeUnit mLastOutputTime;
- Maybe<AwakeTimeStamp> mLastOutputSystemTime;
- Maybe<media::TimeUnit> mLastReportedPosition;
MediaInfo mInfo;
// True when stream is producing audible sound, false when stream is silent.
bool mIsAudioDataAudible = false;
diff --git a/dom/webidl/MediaDebugInfo.webidl b/dom/webidl/MediaDebugInfo.webidl
@@ -117,7 +117,6 @@ dictionary DecodedStreamDebugInfo {
DOMString instance = "";
long long startTime = 0;
long long lastOutputTime = 0;
- long long lastReportedPosition = 0;
long playing = 0;
long long lastAudio = 0;
boolean audioQueueFinished = false;