Bug 1743834 - Make GetClock() non-const on MediaSink, and allow the AudioSink to modify the AudioQueue. r=alwu,media-playback-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D133642
This commit is contained in:
Paul Adenot 2022-05-09 13:20:48 +00:00
Родитель 5403271f08
Коммит 8709902435
7 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -49,7 +49,7 @@ TimeUnit AudioSinkWrapper::GetVideoPosition(TimeStamp aNow) const {
return mPlayDuration + TimeUnit::FromSeconds(delta * mParams.mPlaybackRate);
}
TimeUnit AudioSinkWrapper::GetPosition(TimeStamp* aTimeStamp) const {
TimeUnit AudioSinkWrapper::GetPosition(TimeStamp* aTimeStamp) {
AssertOwnerThread();
MOZ_ASSERT(mIsStarted, "Must be called after playback starts.");

Просмотреть файл

@ -49,9 +49,8 @@ class AudioSinkWrapper : public MediaSink {
public:
template <typename Function>
AudioSinkWrapper(AbstractThread* aOwnerThread,
const MediaQueue<AudioData>& aAudioQueue,
const Function& aFunc, double aVolume, double aPlaybackRate,
bool aPreservesPitch)
MediaQueue<AudioData>& aAudioQueue, const Function& aFunc,
double aVolume, double aPlaybackRate, bool aPreservesPitch)
: mOwnerThread(aOwnerThread),
mCreator(new CreatorImpl<Function>(aFunc)),
mIsStarted(false),
@ -64,7 +63,7 @@ class AudioSinkWrapper : public MediaSink {
RefPtr<EndedPromise> OnEnded(TrackType aType) override;
media::TimeUnit GetEndTime(TrackType aType) const override;
media::TimeUnit GetPosition(TimeStamp* aTimeStamp = nullptr) const override;
media::TimeUnit GetPosition(TimeStamp* aTimeStamp = nullptr) override;
bool HasUnplayedFrames(TrackType aType) const override;
media::TimeUnit UnplayedDuration(TrackType aType) const override;
@ -113,7 +112,7 @@ class AudioSinkWrapper : public MediaSink {
bool mAudioEnded;
MozPromiseRequestHolder<EndedPromise> mAudioSinkEndedPromise;
const MediaQueue<AudioData>& mAudioQueue;
MediaQueue<AudioData>& mAudioQueue;
};
} // namespace mozilla

Просмотреть файл

@ -1066,7 +1066,7 @@ TimeUnit DecodedStream::GetEndTime(TrackType aType) const {
return TimeUnit::Zero();
}
TimeUnit DecodedStream::GetPosition(TimeStamp* aTimeStamp) const {
TimeUnit DecodedStream::GetPosition(TimeStamp* aTimeStamp) {
AssertOwnerThread();
TRACE("DecodedStream::GetPosition");
// This is only called after MDSM starts playback. So mStartTime is

Просмотреть файл

@ -44,7 +44,7 @@ class DecodedStream : public MediaSink {
RefPtr<EndedPromise> OnEnded(TrackType aType) override;
media::TimeUnit GetEndTime(TrackType aType) const override;
media::TimeUnit GetPosition(TimeStamp* aTimeStamp = nullptr) const override;
media::TimeUnit GetPosition(TimeStamp* aTimeStamp = nullptr) override;
bool HasUnplayedFrames(TrackType aType) const override {
// TODO: bug 1755026
return false;

Просмотреть файл

@ -60,8 +60,7 @@ class MediaSink {
// aTimeStamp returns the timeStamp corresponding to the returned position
// which is used by the compositor to derive the render time of video frames.
// Must be called after playback starts.
virtual media::TimeUnit GetPosition(
TimeStamp* aTimeStamp = nullptr) const = 0;
virtual media::TimeUnit GetPosition(TimeStamp* aTimeStamp = nullptr) = 0;
// Return true if there are data consumed but not played yet.
// Can be called in any state.

Просмотреть файл

@ -115,7 +115,7 @@ media::TimeUnit VideoSink::GetEndTime(TrackType aType) const {
return media::TimeUnit::Zero();
}
media::TimeUnit VideoSink::GetPosition(TimeStamp* aTimeStamp) const {
media::TimeUnit VideoSink::GetPosition(TimeStamp* aTimeStamp) {
AssertOwnerThread();
return mAudioSink->GetPosition(aTimeStamp);
}

Просмотреть файл

@ -36,7 +36,7 @@ class VideoSink : public MediaSink {
media::TimeUnit GetEndTime(TrackType aType) const override;
media::TimeUnit GetPosition(TimeStamp* aTimeStamp = nullptr) const override;
media::TimeUnit GetPosition(TimeStamp* aTimeStamp = nullptr) override;
bool HasUnplayedFrames(TrackType aType) const override;
media::TimeUnit UnplayedDuration(TrackType aType) const override;