diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/AccurateSeekTask.h | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/AccurateSeekTask.h')
-rw-r--r-- | dom/media/AccurateSeekTask.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/dom/media/AccurateSeekTask.h b/dom/media/AccurateSeekTask.h new file mode 100644 index 000000000..e2e6771f1 --- /dev/null +++ b/dom/media/AccurateSeekTask.h @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef ACCURATE_SEEK_TASK_H +#define ACCURATE_SEEK_TASK_H + +#include "SeekTask.h" +#include "MediaDecoderReader.h" +#include "SeekJob.h" + +namespace mozilla { + +class AccurateSeekTask final : public SeekTask { +public: + AccurateSeekTask(const void* aDecoderID, + AbstractThread* aThread, + MediaDecoderReaderWrapper* aReader, + const SeekTarget& aTarget, + const MediaInfo& aInfo, + const media::TimeUnit& aEnd, + int64_t aCurrentMediaTime); + + void Discard() override; + + RefPtr<SeekTaskPromise> Seek(const media::TimeUnit& aDuration) override; + + bool NeedToResetMDSM() const override; + +private: + ~AccurateSeekTask(); + + void RequestVideoData(); + + void RequestAudioData(); + + nsresult DropAudioUpToSeekTarget(MediaData* aSample); + + nsresult DropVideoUpToSeekTarget(MediaData* aSample); + + void MaybeFinishSeek(); + + void OnSeekResolved(media::TimeUnit); + + void OnSeekRejected(nsresult aResult); + + void OnAudioDecoded(MediaData* aAudioSample); + + void OnVideoDecoded(MediaData* aVideoSample); + + void OnNotDecoded(MediaData::Type, const MediaResult&); + + void SetCallbacks(); + + void CancelCallbacks(); + + void AdjustFastSeekIfNeeded(MediaData* aSample); + + /* + * Internal state. + */ + const media::TimeUnit mCurrentTimeBeforeSeek; + const uint32_t mAudioRate; // Audio sample rate. + bool mDoneAudioSeeking; + bool mDoneVideoSeeking; + + // This temporarily stores the first frame we decode after we seek. + // This is so that if we hit end of stream while we're decoding to reach + // the seek target, we will still have a frame that we can display as the + // last frame in the media. + RefPtr<MediaData> mFirstVideoFrameAfterSeek; + + /* + * Track the current seek promise made by the reader. + */ + MozPromiseRequestHolder<MediaDecoderReader::SeekPromise> mSeekRequest; + + MediaEventListener mAudioCallback; + MediaEventListener mVideoCallback; + MediaEventListener mAudioWaitCallback; + MediaEventListener mVideoWaitCallback; +}; + +} // namespace mozilla + +#endif /* ACCURATE_SEEK_TASK_H */ |