зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
5403271f08
Коммит
8709902435
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче