summaryrefslogtreecommitdiffstats
path: root/dom/media/platforms/wmf/MFMediaEngineVideoStream.h
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/platforms/wmf/MFMediaEngineVideoStream.h')
-rw-r--r--dom/media/platforms/wmf/MFMediaEngineVideoStream.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/dom/media/platforms/wmf/MFMediaEngineVideoStream.h b/dom/media/platforms/wmf/MFMediaEngineVideoStream.h
index df17c264e4..51fbe4876b 100644
--- a/dom/media/platforms/wmf/MFMediaEngineVideoStream.h
+++ b/dom/media/platforms/wmf/MFMediaEngineVideoStream.h
@@ -19,6 +19,7 @@ class DcompSurfaceImage;
} // namespace layers
class MFMediaSource;
+class MediaRawData;
class MFMediaEngineVideoStream final : public MFMediaEngineStream {
public:
@@ -50,8 +51,13 @@ class MFMediaEngineVideoStream final : public MFMediaEngineStream {
// change happens during playback.
void SetConfig(const TrackInfo& aConfig);
+ RefPtr<MediaDataDecoder::DecodePromise> OutputData(
+ RefPtr<MediaRawData> aSample) override;
+
RefPtr<MediaDataDecoder::DecodePromise> Drain() override;
+ RefPtr<MediaDataDecoder::FlushPromise> Flush() override;
+
bool IsEncrypted() const override;
private:
@@ -66,12 +72,25 @@ class MFMediaEngineVideoStream final : public MFMediaEngineStream {
bool IsDCompImageReady();
- void ResolvePendingDrainPromiseIfNeeded();
+ // Those promises are used to handle decode/drain which happens before the
+ // Dcomp surface is ready.
+ void ResolvePendingPromisesIfNeeded();
void ShutdownCleanUpOnTaskQueue() override;
bool IsEnded() const override;
+ // Before Dcomp surface is ready, we can't return any video data due to
+ // lacking of the image, which should only happen on the beginning of the
+ // video playback. In that situation, once we have enough video raw data, we
+ // can stop delaying the decode promise by waiting the Dcomp surface and
+ // resolveing the promise when Dcomp surface is ready. Doing so helps to keep
+ // the decode promise pending, so that the MFR won't keep sending more input
+ // data, which we actually don't need that many.
+ bool ShouldDelayVideoDecodeBeforeDcompReady();
+
+ void SendRequestSampleEvent(bool aIsEnough) override;
+
// Task queue only members.
HANDLE mDCompSurfaceHandle;
bool mNeedRecreateImage;
@@ -98,6 +117,12 @@ class MFMediaEngineVideoStream final : public MFMediaEngineStream {
// have dcomp image.
MozPromiseHolder<MediaDataDecoder::DecodePromise> mPendingDrainPromise;
+ // The promise used to return all video output which are requested before the
+ // Dcomp surface is ready. This should only be used once in entire playback,
+ // typically happening around the beginning of the playback.
+ MozPromiseHolder<MediaDataDecoder::DecodePromise>
+ mVideoDecodeBeforeDcompPromise;
+
// Set when `CreateMediaType()` is called.
bool mIsEncrypted = false;
};