Backed out changeset 157be32d85fe (bug 1504643) for conflicts while backing out bug 1471535

This commit is contained in:
Dorel Luca 2018-11-09 12:13:54 +02:00
parent a937d45657
commit c34d2cd0fa
16 changed files with 104 additions and 111 deletions

View File

@ -335,7 +335,7 @@ BenchmarkPlayback::GlobalShutdown()
} }
void void
BenchmarkPlayback::Output(MediaDataDecoder::DecodedData&& aResults) BenchmarkPlayback::Output(const MediaDataDecoder::DecodedData& aResults)
{ {
MOZ_ASSERT(OnThread()); MOZ_ASSERT(OnThread());
MOZ_ASSERT(!mFinished); MOZ_ASSERT(!mFinished);
@ -391,14 +391,14 @@ BenchmarkPlayback::InputExhausted()
if (mSampleIndex == mSamples.Length() && !ref->mParameters.mStopAtFrame) { if (mSampleIndex == mSamples.Length() && !ref->mParameters.mStopAtFrame) {
// Complete current frame decode then drain if still necessary. // Complete current frame decode then drain if still necessary.
p->Then(Thread(), __func__, p->Then(Thread(), __func__,
[ref, this](MediaDataDecoder::DecodedData&& aResults) { [ref, this](const MediaDataDecoder::DecodedData& aResults) {
Output(std::move(aResults)); Output(aResults);
if (!mFinished) { if (!mFinished) {
mDecoder->Drain()->Then( mDecoder->Drain()->Then(
Thread(), __func__, Thread(), __func__,
[ref, this](MediaDataDecoder::DecodedData&& aResults) { [ref, this](const MediaDataDecoder::DecodedData& aResults) {
mDrained = true; mDrained = true;
Output(std::move(aResults)); Output(aResults);
MOZ_ASSERT(mFinished, "We must be done now"); MOZ_ASSERT(mFinished, "We must be done now");
}, },
[ref, this](const MediaResult& aError) { Error(aError); }); [ref, this](const MediaResult& aError) { Error(aError); });
@ -411,8 +411,8 @@ BenchmarkPlayback::InputExhausted()
} }
// Continue decoding // Continue decoding
p->Then(Thread(), __func__, p->Then(Thread(), __func__,
[ref, this](MediaDataDecoder::DecodedData&& aResults) { [ref, this](const MediaDataDecoder::DecodedData& aResults) {
Output(std::move(aResults)); Output(aResults);
if (!mFinished) { if (!mFinished) {
InputExhausted(); InputExhausted();
} }

View File

@ -29,7 +29,7 @@ class BenchmarkPlayback : public QueueObject
void GlobalShutdown(); void GlobalShutdown();
void InitDecoder(TrackInfo&& aInfo); void InitDecoder(TrackInfo&& aInfo);
void Output(MediaDataDecoder::DecodedData&& aResults); void Output(const MediaDataDecoder::DecodedData& aResults);
void Error(const MediaResult& aError); void Error(const MediaResult& aError);
void InputExhausted(); void InputExhausted();

View File

@ -1845,7 +1845,7 @@ MediaFormatReader::OnAudioDemuxCompleted(
void void
MediaFormatReader::NotifyNewOutput( MediaFormatReader::NotifyNewOutput(
TrackType aTrack, MediaDataDecoder::DecodedData&& aResults) TrackType aTrack, const MediaDataDecoder::DecodedData& aResults)
{ {
MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(OnTaskQueue());
auto& decoder = GetDecoderData(aTrack); auto& decoder = GetDecoderData(aTrack);
@ -1854,7 +1854,7 @@ MediaFormatReader::NotifyNewOutput(
aTrack == TrackInfo::kAudioTrack ? "decoded_audio" : "decoded_video", aTrack == TrackInfo::kAudioTrack ? "decoded_audio" : "decoded_video",
"no output samples"); "no output samples");
} else } else
for (auto&& sample : aResults) { for (auto& sample : aResults) {
if (DecoderDoctorLogger::IsDDLoggingEnabled()) { if (DecoderDoctorLogger::IsDDLoggingEnabled()) {
switch (sample->mType) { switch (sample->mType) {
case MediaData::AUDIO_DATA: case MediaData::AUDIO_DATA:
@ -2180,9 +2180,9 @@ MediaFormatReader::DecodeDemuxedSamples(TrackType aTrack,
decoder.mDecoder->Decode(aSample) decoder.mDecoder->Decode(aSample)
->Then(mTaskQueue, __func__, ->Then(mTaskQueue, __func__,
[self, aTrack, &decoder] [self, aTrack, &decoder]
(MediaDataDecoder::DecodedData&& aResults) { (const MediaDataDecoder::DecodedData& aResults) {
decoder.mDecodeRequest.Complete(); decoder.mDecodeRequest.Complete();
self->NotifyNewOutput(aTrack, std::move(aResults)); self->NotifyNewOutput(aTrack, aResults);
// When we recovered from a GPU crash and get the first decoded // When we recovered from a GPU crash and get the first decoded
// frame, report the recovery time telemetry. // frame, report the recovery time telemetry.
@ -2395,13 +2395,13 @@ MediaFormatReader::DrainDecoder(TrackType aTrack)
decoder.mDecoder->Drain() decoder.mDecoder->Drain()
->Then(mTaskQueue, __func__, ->Then(mTaskQueue, __func__,
[self, aTrack, &decoder] [self, aTrack, &decoder]
(MediaDataDecoder::DecodedData&& aResults) { (const MediaDataDecoder::DecodedData& aResults) {
decoder.mDrainRequest.Complete(); decoder.mDrainRequest.Complete();
DDLOGEX(self.get(), DDLogCategory::Log, "drained", DDNoValue{}); DDLOGEX(self.get(), DDLogCategory::Log, "drained", DDNoValue{});
if (aResults.IsEmpty()) { if (aResults.IsEmpty()) {
decoder.mDrainState = DrainState::DrainCompleted; decoder.mDrainState = DrainState::DrainCompleted;
} else { } else {
self->NotifyNewOutput(aTrack, std::move(aResults)); self->NotifyNewOutput(aTrack, aResults);
// Let's see if we have any more data available to drain. // Let's see if we have any more data available to drain.
decoder.mDrainState = DrainState::PartialDrainPending; decoder.mDrainState = DrainState::PartialDrainPending;
} }

View File

@ -318,7 +318,7 @@ private:
// Drain the current decoder. // Drain the current decoder.
void DrainDecoder(TrackType aTrack); void DrainDecoder(TrackType aTrack);
void NotifyNewOutput(TrackType aTrack, void NotifyNewOutput(TrackType aTrack,
MediaDataDecoder::DecodedData&& aResults); const MediaDataDecoder::DecodedData& aResults);
void NotifyError(TrackType aTrack, const MediaResult& aError); void NotifyError(TrackType aTrack, const MediaResult& aError);
void NotifyWaitingForData(TrackType aTrack); void NotifyWaitingForData(TrackType aTrack);
void NotifyWaitingForKey(TrackType aTrack); void NotifyWaitingForKey(TrackType aTrack);

View File

@ -119,8 +119,8 @@ mozilla::ipc::IPCResult
RemoteVideoDecoderChild::RecvInputExhausted() RemoteVideoDecoderChild::RecvInputExhausted()
{ {
AssertOnManagerThread(); AssertOnManagerThread();
mDecodePromise.ResolveIfExists(std::move(mDecodedData), __func__); mDecodePromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData = MediaDataDecoder::DecodedData(); mDecodedData.Clear();
return IPC_OK(); return IPC_OK();
} }
@ -128,8 +128,8 @@ mozilla::ipc::IPCResult
RemoteVideoDecoderChild::RecvDrainComplete() RemoteVideoDecoderChild::RecvDrainComplete()
{ {
AssertOnManagerThread(); AssertOnManagerThread();
mDecodePromise.ResolveIfExists(std::move(mDecodedData), __func__); mDrainPromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData = MediaDataDecoder::DecodedData(); mDecodedData.Clear();
return IPC_OK(); return IPC_OK();
} }
@ -137,7 +137,7 @@ mozilla::ipc::IPCResult
RemoteVideoDecoderChild::RecvError(const nsresult& aError) RemoteVideoDecoderChild::RecvError(const nsresult& aError)
{ {
AssertOnManagerThread(); AssertOnManagerThread();
mDecodedData = MediaDataDecoder::DecodedData(); mDecodedData.Clear();
mDecodePromise.RejectIfExists(aError, __func__); mDecodePromise.RejectIfExists(aError, __func__);
mDrainPromise.RejectIfExists(aError, __func__); mDrainPromise.RejectIfExists(aError, __func__);
mFlushPromise.RejectIfExists(aError, __func__); mFlushPromise.RejectIfExists(aError, __func__);

View File

@ -81,8 +81,8 @@ mozilla::ipc::IPCResult
VideoDecoderChild::RecvInputExhausted() VideoDecoderChild::RecvInputExhausted()
{ {
AssertOnManagerThread(); AssertOnManagerThread();
mDecodePromise.ResolveIfExists(std::move(mDecodedData), __func__); mDecodePromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData = MediaDataDecoder::DecodedData(); mDecodedData.Clear();
return IPC_OK(); return IPC_OK();
} }
@ -90,8 +90,8 @@ mozilla::ipc::IPCResult
VideoDecoderChild::RecvDrainComplete() VideoDecoderChild::RecvDrainComplete()
{ {
AssertOnManagerThread(); AssertOnManagerThread();
mDrainPromise.ResolveIfExists(std::move(mDecodedData), __func__); mDrainPromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData = MediaDataDecoder::DecodedData(); mDecodedData.Clear();
return IPC_OK(); return IPC_OK();
} }
@ -99,7 +99,7 @@ mozilla::ipc::IPCResult
VideoDecoderChild::RecvError(const nsresult& aError) VideoDecoderChild::RecvError(const nsresult& aError)
{ {
AssertOnManagerThread(); AssertOnManagerThread();
mDecodedData = MediaDataDecoder::DecodedData(); mDecodedData.Clear();
mDecodePromise.RejectIfExists(aError, __func__); mDecodePromise.RejectIfExists(aError, __func__);
mDrainPromise.RejectIfExists(aError, __func__); mDrainPromise.RejectIfExists(aError, __func__);
mFlushPromise.RejectIfExists(aError, __func__); mFlushPromise.RejectIfExists(aError, __func__);
@ -153,7 +153,7 @@ VideoDecoderChild::ActorDestroy(ActorDestroyReason aWhy)
MediaResult error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER); MediaResult error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER);
error.SetGPUCrashTimeStamp(ref->mGPUCrashTime); error.SetGPUCrashTimeStamp(ref->mGPUCrashTime);
if (ref->mInitialized) { if (ref->mInitialized) {
mDecodedData = MediaDataDecoder::DecodedData(); mDecodedData.Clear();
mDecodePromise.RejectIfExists(error, __func__); mDecodePromise.RejectIfExists(error, __func__);
mDrainPromise.RejectIfExists(error, __func__); mDrainPromise.RejectIfExists(error, __func__);
mFlushPromise.RejectIfExists(error, __func__); mFlushPromise.RejectIfExists(error, __func__);

View File

@ -165,11 +165,11 @@ VideoDecoderParent::RecvInput(const MediaRawDataIPDL& aData)
RefPtr<VideoDecoderParent> self = this; RefPtr<VideoDecoderParent> self = this;
mDecoder->Decode(data)->Then( mDecoder->Decode(data)->Then(
mManagerTaskQueue, __func__, mManagerTaskQueue, __func__,
[self, this](MediaDataDecoder::DecodedData&& aResults) { [self, this](const MediaDataDecoder::DecodedData& aResults) {
if (mDestroyed) { if (mDestroyed) {
return; return;
} }
ProcessDecodedData(std::move(aResults)); ProcessDecodedData(aResults);
Unused << SendInputExhausted(); Unused << SendInputExhausted();
}, },
[self](const MediaResult& aError) { self->Error(aError); }); [self](const MediaResult& aError) { self->Error(aError); });
@ -177,7 +177,8 @@ VideoDecoderParent::RecvInput(const MediaRawDataIPDL& aData)
} }
void void
VideoDecoderParent::ProcessDecodedData(MediaDataDecoder::DecodedData&& aData) VideoDecoderParent::ProcessDecodedData(
const MediaDataDecoder::DecodedData& aData)
{ {
MOZ_ASSERT(OnManagerThread()); MOZ_ASSERT(OnManagerThread());
@ -186,7 +187,7 @@ VideoDecoderParent::ProcessDecodedData(MediaDataDecoder::DecodedData&& aData)
return; return;
} }
for (auto&& data : aData) { for (const auto& data : aData) {
MOZ_ASSERT(data->mType == MediaData::VIDEO_DATA, MOZ_ASSERT(data->mType == MediaData::VIDEO_DATA,
"Can only decode videos using VideoDecoderParent!"); "Can only decode videos using VideoDecoderParent!");
VideoData* video = static_cast<VideoData*>(data.get()); VideoData* video = static_cast<VideoData*>(data.get());
@ -199,7 +200,7 @@ VideoDecoderParent::ProcessDecodedData(MediaDataDecoder::DecodedData&& aData)
if (!texture) { if (!texture) {
texture = ImageClient::CreateTextureClientForImage(video->mImage, texture = ImageClient::CreateTextureClientForImage(video->mImage,
mKnowsCompositor); mKnowsCompositor);
} }
if (texture && !texture->IsAddedToCompositableClient()) { if (texture && !texture->IsAddedToCompositableClient()) {
@ -247,9 +248,9 @@ VideoDecoderParent::RecvDrain()
RefPtr<VideoDecoderParent> self = this; RefPtr<VideoDecoderParent> self = this;
mDecoder->Drain()->Then( mDecoder->Drain()->Then(
mManagerTaskQueue, __func__, mManagerTaskQueue, __func__,
[self, this](MediaDataDecoder::DecodedData&& aResults) { [self, this](const MediaDataDecoder::DecodedData& aResults) {
if (!mDestroyed) { if (!mDestroyed) {
ProcessDecodedData(std::move(aResults)); ProcessDecodedData(aResults);
Unused << SendDrainComplete(); Unused << SendDrainComplete();
} }
}, },

View File

@ -53,7 +53,7 @@ private:
void Error(const MediaResult& aError); void Error(const MediaResult& aError);
~VideoDecoderParent(); ~VideoDecoderParent();
void ProcessDecodedData(MediaDataDecoder::DecodedData&& aData); void ProcessDecodedData(const MediaDataDecoder::DecodedData& aData);
RefPtr<VideoDecoderManagerParent> mParent; RefPtr<VideoDecoderManagerParent> mParent;
RefPtr<VideoDecoderParent> mIPDLSelfRef; RefPtr<VideoDecoderParent> mIPDLSelfRef;

View File

@ -251,10 +251,8 @@ MediaCapabilities::DecodingInfo(
promises.AppendElement(InvokeAsync( promises.AppendElement(InvokeAsync(
taskQueue, taskQueue,
__func__, __func__,
[ taskQueue, [taskQueue, frameRate, compositor, config = std::move(config)]() mutable
frameRate, -> RefPtr<CapabilitiesPromise> {
compositor,
config = std::move(config) ]() mutable -> RefPtr<CapabilitiesPromise> {
// MediaDataDecoder keeps a reference to the config object, so we must // MediaDataDecoder keeps a reference to the config object, so we must
// keep it alive until the decoder has been shutdown. // keep it alive until the decoder has been shutdown.
CreateDecoderParams params{ *config, CreateDecoderParams params{ *config,
@ -266,25 +264,25 @@ MediaCapabilities::DecodingInfo(
return AllocationWrapper::CreateDecoder(params)->Then( return AllocationWrapper::CreateDecoder(params)->Then(
taskQueue, taskQueue,
__func__, __func__,
[ taskQueue, frameRate, config = std::move(config) ]( [taskQueue, frameRate, config = std::move(config)](
AllocationWrapper::AllocateDecoderPromise::ResolveOrRejectValue&& const AllocationWrapper::AllocateDecoderPromise::
aValue) mutable { ResolveOrRejectValue& aValue) mutable {
if (aValue.IsReject()) { if (aValue.IsReject()) {
return CapabilitiesPromise::CreateAndReject( return CapabilitiesPromise::CreateAndReject(aValue.RejectValue(),
std::move(aValue.RejectValue()), __func__); __func__);
} }
RefPtr<MediaDataDecoder> decoder = std::move(aValue.ResolveValue()); RefPtr<MediaDataDecoder> decoder = aValue.ResolveValue();
// We now query the decoder to determine if it's power efficient. // We now query the decoder to determine if it's power efficient.
RefPtr<CapabilitiesPromise> p = decoder->Init()->Then( RefPtr<CapabilitiesPromise> p = decoder->Init()->Then(
taskQueue, taskQueue,
__func__, __func__,
[ taskQueue, decoder, frameRate, config = std::move(config) ]( [taskQueue, decoder, frameRate, config = std::move(config)](
MediaDataDecoder::InitPromise::ResolveOrRejectValue&& const MediaDataDecoder::InitPromise::ResolveOrRejectValue&
aValue) mutable { aValue) mutable {
RefPtr<CapabilitiesPromise> p; RefPtr<CapabilitiesPromise> p;
if (aValue.IsReject()) { if (aValue.IsReject()) {
p = CapabilitiesPromise::CreateAndReject( p = CapabilitiesPromise::CreateAndReject(aValue.RejectValue(),
std::move(aValue.RejectValue()), __func__); __func__);
} else { } else {
MOZ_ASSERT(config->IsVideo()); MOZ_ASSERT(config->IsVideo());
nsAutoCString reason; nsAutoCString reason;
@ -370,15 +368,14 @@ MediaCapabilities::DecodingInfo(
->Then( ->Then(
targetThread, targetThread,
__func__, __func__,
[ [promise,
promise, tracks = std::move(tracks),
tracks = std::move(tracks), workerRef,
workerRef, holder,
holder, aConfiguration,
aConfiguration, self,
self, this](const CapabilitiesPromise::AllPromiseType::ResolveOrRejectValue&
this aValue) {
](CapabilitiesPromise::AllPromiseType::ResolveOrRejectValue&& aValue) {
holder->Complete(); holder->Complete();
if (aValue.IsReject()) { if (aValue.IsReject()) {
auto info = auto info =

View File

@ -214,12 +214,14 @@ public:
writer->mCrypto = CryptoSample(); writer->mCrypto = CryptoSample();
RefPtr<EMEDecryptor> self = this; RefPtr<EMEDecryptor> self = this;
mDecoder->Decode(aDecrypted.mSample) mDecoder->Decode(aDecrypted.mSample)
->Then(mTaskQueue, ->Then(mTaskQueue, __func__,
__func__, [self](const DecodedData& aResults) {
[self](DecodePromise::ResolveOrRejectValue&& aValue) {
self->mDecodeRequest.Complete(); self->mDecodeRequest.Complete();
self->mDecodePromise.ResolveOrReject(std::move(aValue), self->mDecodePromise.ResolveIfExists(aResults, __func__);
__func__); },
[self](const MediaResult& aError) {
self->mDecodeRequest.Complete();
self->mDecodePromise.RejectIfExists(aError, __func__);
}) })
->Track(mDecodeRequest); ->Track(mDecodeRequest);
} }
@ -348,14 +350,16 @@ EMEMediaDataDecoderProxy::Decode(MediaRawData* aSample)
mKeyRequest.Complete(); mKeyRequest.Complete();
MediaDataDecoderProxy::Decode(aSample) MediaDataDecoderProxy::Decode(aSample)
->Then( ->Then(mTaskQueue,
mTaskQueue, __func__,
__func__, [self, this](const DecodedData& aResults) {
[self, this](DecodePromise::ResolveOrRejectValue&& aValue) { mDecodeRequest.Complete();
mDecodeRequest.Complete(); mDecodePromise.Resolve(aResults, __func__);
mDecodePromise.ResolveOrReject(std::move(aValue), },
__func__); [self, this](const MediaResult& aError) {
}) mDecodeRequest.Complete();
mDecodePromise.Reject(aError, __func__);
})
->Track(mDecodeRequest); ->Track(mDecodeRequest);
}, },
[self]() { [self]() {

View File

@ -101,16 +101,16 @@ void
GMPVideoDecoder::InputDataExhausted() GMPVideoDecoder::InputDataExhausted()
{ {
MOZ_ASSERT(IsOnGMPThread()); MOZ_ASSERT(IsOnGMPThread());
mDecodePromise.ResolveIfExists(std::move(mDecodedData), __func__); mDecodePromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData = DecodedData(); mDecodedData.Clear();
} }
void void
GMPVideoDecoder::DrainComplete() GMPVideoDecoder::DrainComplete()
{ {
MOZ_ASSERT(IsOnGMPThread()); MOZ_ASSERT(IsOnGMPThread());
mDrainPromise.ResolveIfExists(std::move(mDecodedData), __func__); mDrainPromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData = DecodedData(); mDecodedData.Clear();
} }
void void

View File

@ -498,7 +498,7 @@ RemoteDataDecoder::Flush()
{ {
RefPtr<RemoteDataDecoder> self = this; RefPtr<RemoteDataDecoder> self = this;
return InvokeAsync(mTaskQueue, __func__, [self, this]() { return InvokeAsync(mTaskQueue, __func__, [self, this]() {
mDecodedData = DecodedData(); mDecodedData.Clear();
mNumPendingInputs = 0; mNumPendingInputs = 0;
mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
@ -726,12 +726,12 @@ RemoteDataDecoder::ReturnDecodedData()
// We only want to clear mDecodedData when we have resolved the promises. // We only want to clear mDecodedData when we have resolved the promises.
if (!mDecodePromise.IsEmpty()) { if (!mDecodePromise.IsEmpty()) {
mDecodePromise.Resolve(std::move(mDecodedData), __func__); mDecodePromise.Resolve(mDecodedData, __func__);
mDecodedData = DecodedData(); mDecodedData.Clear();
} else if (!mDrainPromise.IsEmpty() && } else if (!mDrainPromise.IsEmpty() &&
(!mDecodedData.IsEmpty() || mDrainStatus == DrainStatus::DRAINED)) { (!mDecodedData.IsEmpty() || mDrainStatus == DrainStatus::DRAINED)) {
mDrainPromise.Resolve(std::move(mDecodedData), __func__); mDrainPromise.Resolve(mDecodedData, __func__);
mDecodedData = DecodedData(); mDecodedData.Clear();
} }
} }

View File

@ -223,9 +223,7 @@ AppleATDecoder::ProcessDecode(MediaRawData* aSample)
mQueuedSamples.Clear(); mQueuedSamples.Clear();
} }
DecodedData results = std::move(mDecodedSamples); return DecodePromise::CreateAndResolve(std::move(mDecodedSamples), __func__);
mDecodedSamples = DecodedData();
return DecodePromise::CreateAndResolve(std::move(results), __func__);
} }
MediaResult MediaResult

View File

@ -137,12 +137,15 @@ OmxDataDecoder::EndOfStream()
RefPtr<OmxDataDecoder> self = this; RefPtr<OmxDataDecoder> self = this;
mOmxLayer->SendCommand(OMX_CommandFlush, OMX_ALL, nullptr) mOmxLayer->SendCommand(OMX_CommandFlush, OMX_ALL, nullptr)
->Then(mOmxTaskQueue, ->Then(mOmxTaskQueue, __func__,
__func__, [self, this] () {
[self, this](OmxCommandPromise::ResolveOrRejectValue&& aValue) { mDrainPromise.ResolveIfExists(mDecodedData, __func__);
mDrainPromise.ResolveIfExists(std::move(mDecodedData), __func__); mDecodedData.Clear();
mDecodedData = DecodedData(); },
}); [self, this] () {
mDrainPromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData.Clear();
});
} }
RefPtr<MediaDataDecoder::InitPromise> RefPtr<MediaDataDecoder::InitPromise>
@ -398,8 +401,8 @@ OmxDataDecoder::EmptyBufferDone(BufferData* aData)
return; return;
} }
mDecodePromise.ResolveIfExists(std::move(mDecodedData), __func__); mDecodePromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData = DecodedData(); mDecodedData.Clear();
}); });
nsresult rv = mOmxTaskQueue->Dispatch(r.forget()); nsresult rv = mOmxTaskQueue->Dispatch(r.forget());
@ -419,7 +422,7 @@ OmxDataDecoder::NotifyError(OMX_ERRORTYPE aOmxError, const char* aLine, const Me
{ {
LOG("NotifyError %d (%s) at %s", static_cast<int>(aOmxError), LOG("NotifyError %d (%s) at %s", static_cast<int>(aOmxError),
aError.ErrorName().get(), aLine); aError.ErrorName().get(), aLine);
mDecodedData = DecodedData(); mDecodedData.Clear();
mDecodePromise.RejectIfExists(aError, __func__); mDecodePromise.RejectIfExists(aError, __func__);
mDrainPromise.RejectIfExists(aError, __func__); mDrainPromise.RejectIfExists(aError, __func__);
mFlushPromise.RejectIfExists(aError, __func__); mFlushPromise.RejectIfExists(aError, __func__);
@ -852,7 +855,7 @@ OmxDataDecoder::DoFlush()
{ {
MOZ_ASSERT(mOmxTaskQueue->IsCurrentThreadIn()); MOZ_ASSERT(mOmxTaskQueue->IsCurrentThreadIn());
mDecodedData = DecodedData(); mDecodedData.Clear();
mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);

View File

@ -552,8 +552,8 @@ MediaChangeMonitor::DecodeFirstSample(MediaRawData* aSample)
AssertOnTaskQueue(); AssertOnTaskQueue();
if (mNeedKeyframe && !aSample->mKeyframe) { if (mNeedKeyframe && !aSample->mKeyframe) {
mDecodePromise.Resolve(std::move(mPendingFrames), __func__); mDecodePromise.Resolve(mPendingFrames, __func__);
mPendingFrames = DecodedData(); mPendingFrames.Clear();
return; return;
} }
@ -569,11 +569,11 @@ MediaChangeMonitor::DecodeFirstSample(MediaRawData* aSample)
RefPtr<MediaChangeMonitor> self = this; RefPtr<MediaChangeMonitor> self = this;
mDecoder->Decode(aSample) mDecoder->Decode(aSample)
->Then(AbstractThread::GetCurrent()->AsTaskQueue(), __func__, ->Then(AbstractThread::GetCurrent()->AsTaskQueue(), __func__,
[self, this](MediaDataDecoder::DecodedData&& aResults) { [self, this](const MediaDataDecoder::DecodedData& aResults) {
mDecodePromiseRequest.Complete(); mDecodePromiseRequest.Complete();
mPendingFrames.AppendElements(std::move(aResults)); mPendingFrames.AppendElements(aResults);
mDecodePromise.Resolve(std::move(mPendingFrames), __func__); mDecodePromise.Resolve(mPendingFrames, __func__);
mPendingFrames = DecodedData(); mPendingFrames.Clear();
}, },
[self, this](const MediaResult& aError) { [self, this](const MediaResult& aError) {
mDecodePromiseRequest.Complete(); mDecodePromiseRequest.Complete();
@ -619,7 +619,7 @@ MediaChangeMonitor::DrainThenFlushDecoder(MediaRawData* aPendingSample)
mDecoder->Drain() mDecoder->Drain()
->Then(AbstractThread::GetCurrent()->AsTaskQueue(), ->Then(AbstractThread::GetCurrent()->AsTaskQueue(),
__func__, __func__,
[self, sample, this](MediaDataDecoder::DecodedData&& aResults) { [self, sample, this](const MediaDataDecoder::DecodedData& aResults) {
mDrainRequest.Complete(); mDrainRequest.Complete();
if (!mFlushPromise.IsEmpty()) { if (!mFlushPromise.IsEmpty()) {
// A Flush is pending, abort the current operation. // A Flush is pending, abort the current operation.
@ -627,7 +627,7 @@ MediaChangeMonitor::DrainThenFlushDecoder(MediaRawData* aPendingSample)
return; return;
} }
if (aResults.Length() > 0) { if (aResults.Length() > 0) {
mPendingFrames.AppendElements(std::move(aResults)); mPendingFrames.AppendElements(aResults);
DrainThenFlushDecoder(sample); DrainThenFlushDecoder(sample);
return; return;
} }

View File

@ -1219,11 +1219,6 @@ public:
template<typename ResolveValueType_> template<typename ResolveValueType_>
void Resolve(ResolveValueType_&& aResolveValue, const char* aMethodName) void Resolve(ResolveValueType_&& aResolveValue, const char* aMethodName)
{ {
static_assert(
IsConvertible<ResolveValueType_,
typename PromiseType::ResolveValueType>::value,
"Resolve() argument must be convertible to MozPromise's ResolveValueT");
if (mMonitor) { if (mMonitor) {
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
} }
@ -1245,11 +1240,6 @@ public:
template<typename RejectValueType_> template<typename RejectValueType_>
void Reject(RejectValueType_&& aRejectValue, const char* aMethodName) void Reject(RejectValueType_&& aRejectValue, const char* aMethodName)
{ {
static_assert(
IsConvertible<RejectValueType_,
typename PromiseType::RejectValueType>::value,
"Reject() argument must be convertible to MozPromise's RejectValueT");
if (mMonitor) { if (mMonitor) {
mMonitor->AssertCurrentThreadOwns(); mMonitor->AssertCurrentThreadOwns();
} }