зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1840965 - Move Flush to template r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D189016
This commit is contained in:
Родитель
6c5416a4a2
Коммит
17a6baba0e
|
@ -217,6 +217,34 @@ void DecoderTemplate<DecoderType>::Decode(InputType& aInput, ErrorResult& aRv) {
|
|||
ProcessControlMessageQueue();
|
||||
}
|
||||
|
||||
template <typename DecoderType>
|
||||
already_AddRefed<Promise> DecoderTemplate<DecoderType>::Flush(
|
||||
ErrorResult& aRv) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
LOG("VideoDecoder %p, Flush", this);
|
||||
|
||||
if (mState != CodecState::Configured) {
|
||||
LOG("VideoDecoder %p, wrong state!", this);
|
||||
aRv.ThrowInvalidStateError("Decoder must be configured first");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<Promise> p = Promise::Create(GetParentObject(), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
mKeyChunkRequired = true;
|
||||
|
||||
mControlMessageQueue.emplace(UniquePtr<ControlMessage>(
|
||||
new FlushMessage(++mFlushCounter, mLatestConfigureId, p)));
|
||||
LOG("VideoDecoder %p enqueues %s", this,
|
||||
mControlMessageQueue.back()->ToString().get());
|
||||
ProcessControlMessageQueue();
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
template <typename DecoderType>
|
||||
void DecoderTemplate<DecoderType>::Reset(ErrorResult& aRv) {
|
||||
AssertIsOnOwningThread();
|
||||
|
|
|
@ -157,6 +157,8 @@ class DecoderTemplate : public DOMEventTargetHelper {
|
|||
|
||||
virtual void Decode(InputType& aInput, ErrorResult& aRv);
|
||||
|
||||
virtual already_AddRefed<Promise> Flush(ErrorResult& aRv);
|
||||
|
||||
virtual void Reset(ErrorResult& aRv);
|
||||
|
||||
virtual void Close(ErrorResult& aRv);
|
||||
|
|
|
@ -750,33 +750,6 @@ already_AddRefed<VideoDecoder> VideoDecoder::Constructor(
|
|||
RefPtr<VideoFrameOutputCallback>(aInit.mOutput));
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webcodecs/#dom-videodecoder-flush
|
||||
already_AddRefed<Promise> VideoDecoder::Flush(ErrorResult& aRv) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
LOG("VideoDecoder %p, Flush", this);
|
||||
|
||||
if (mState != CodecState::Configured) {
|
||||
LOG("VideoDecoder %p, wrong state!", this);
|
||||
aRv.ThrowInvalidStateError("Decoder must be configured first");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<Promise> p = Promise::Create(GetParentObject(), aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
mKeyChunkRequired = true;
|
||||
|
||||
mControlMessageQueue.emplace(UniquePtr<ControlMessage>(
|
||||
new FlushMessage(++mFlushCounter, mLatestConfigureId, p)));
|
||||
LOG("VideoDecoder %p enqueues %s", this,
|
||||
mControlMessageQueue.back()->ToString().get());
|
||||
ProcessControlMessageQueue();
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
// https://w3c.github.io/webcodecs/#dom-videodecoder-isconfigsupported
|
||||
/* static */
|
||||
already_AddRefed<Promise> VideoDecoder::IsConfigSupported(
|
||||
|
|
|
@ -90,8 +90,6 @@ class VideoDecoder final : public DecoderTemplate<VideoDecoderTraits> {
|
|||
const GlobalObject& aGlobal, const VideoDecoderInit& aInit,
|
||||
ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise> Flush(ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<Promise> IsConfigSupported(
|
||||
const GlobalObject& aGlobal, const VideoDecoderConfig& aConfig,
|
||||
ErrorResult& aRv);
|
||||
|
|
Загрузка…
Ссылка в новой задаче