--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -2014,31 +2014,31 @@ MediaFormatReader::DecodeDemuxedSamples(
MediaRawData* aSample)
{
MOZ_ASSERT(OnTaskQueue());
auto& decoder = GetDecoderData(aTrack);
RefPtr<MediaFormatReader> self = this;
decoder.mFlushed = false;
decoder.mDecoder->Decode(aSample)
->Then(mTaskQueue, __func__,
- [self, this, aTrack, &decoder]
+ [self, aTrack, &decoder]
(const MediaDataDecoder::DecodedData& aResults) {
decoder.mDecodeRequest.Complete();
- NotifyNewOutput(aTrack, aResults);
+ self->NotifyNewOutput(aTrack, aResults);
// When we recovered from a GPU crash and get the first decoded
// frame, report the recovery time telemetry.
if (aTrack == TrackType::kVideoTrack) {
GPUProcessCrashTelemetryLogger::ReportTelemetry(
- mMediaDecoderOwnerID, decoder.mDecoder.get());
+ self->mMediaDecoderOwnerID, decoder.mDecoder.get());
}
},
- [self, this, aTrack, &decoder](const MediaResult& aError) {
+ [self, aTrack, &decoder](const MediaResult& aError) {
decoder.mDecodeRequest.Complete();
- NotifyError(aTrack, aError);
+ self->NotifyError(aTrack, aError);
})
->Track(decoder.mDecodeRequest);
}
void
MediaFormatReader::HandleDemuxedSamples(
TrackType aTrack, FrameStatistics::AutoNotifyDecoded& aA)
{
@@ -2203,31 +2203,31 @@ MediaFormatReader::DrainDecoder(TrackTyp
return;
}
decoder.mDrainState = DrainState::Draining;
RefPtr<MediaFormatReader> self = this;
decoder.mDecoder->Drain()
->Then(mTaskQueue, __func__,
- [self, this, aTrack, &decoder]
+ [self, aTrack, &decoder]
(const MediaDataDecoder::DecodedData& aResults) {
decoder.mDrainRequest.Complete();
if (aResults.IsEmpty()) {
decoder.mDrainState = DrainState::DrainCompleted;
} else {
- NotifyNewOutput(aTrack, aResults);
+ self->NotifyNewOutput(aTrack, aResults);
// Let's see if we have any more data available to drain.
decoder.mDrainState = DrainState::PartialDrainPending;
}
- ScheduleUpdate(aTrack);
+ self->ScheduleUpdate(aTrack);
},
- [self, this, aTrack, &decoder](const MediaResult& aError) {
+ [self, aTrack, &decoder](const MediaResult& aError) {
decoder.mDrainRequest.Complete();
- NotifyError(aTrack, aError);
+ self->NotifyError(aTrack, aError);
})
->Track(decoder.mDrainRequest);
LOG("Requesting %s decoder to drain", TrackTypeToStr(aTrack));
}
void
MediaFormatReader::Update(TrackType aTrack)
{
--- a/dom/media/ipc/RemoteVideoDecoder.cpp
+++ b/dom/media/ipc/RemoteVideoDecoder.cpp
@@ -51,17 +51,17 @@ RemoteVideoDecoder::~RemoteVideoDecoder(
}
RefPtr<MediaDataDecoder::InitPromise>
RemoteVideoDecoder::Init()
{
RefPtr<RemoteVideoDecoder> self = this;
return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(),
__func__,
- [self, this]() { return mActor->Init(); })
+ [self]() { return self->mActor->Init(); })
->Then(VideoDecoderManagerChild::GetManagerAbstractThread(),
__func__,
[self, this](TrackType aTrack) {
mDescription =
mActor->GetDescriptionName() + NS_LITERAL_CSTRING(" (remote)");
mIsHardwareAccelerated =
mActor->IsHardwareAccelerated(mHardwareAcceleratedReason);
mConversion = mActor->NeedsConversion();
@@ -74,42 +74,42 @@ RemoteVideoDecoder::Init()
RefPtr<MediaDataDecoder::DecodePromise>
RemoteVideoDecoder::Decode(MediaRawData* aSample)
{
RefPtr<RemoteVideoDecoder> self = this;
RefPtr<MediaRawData> sample = aSample;
return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(),
__func__,
- [self, this, sample]() { return mActor->Decode(sample); });
+ [self, sample]() { return self->mActor->Decode(sample); });
}
RefPtr<MediaDataDecoder::FlushPromise>
RemoteVideoDecoder::Flush()
{
RefPtr<RemoteVideoDecoder> self = this;
return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(),
- __func__, [self, this]() { return mActor->Flush(); });
+ __func__, [self]() { return self->mActor->Flush(); });
}
RefPtr<MediaDataDecoder::DecodePromise>
RemoteVideoDecoder::Drain()
{
RefPtr<RemoteVideoDecoder> self = this;
return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(),
- __func__, [self, this]() { return mActor->Drain(); });
+ __func__, [self]() { return self->mActor->Drain(); });
}
RefPtr<ShutdownPromise>
RemoteVideoDecoder::Shutdown()
{
RefPtr<RemoteVideoDecoder> self = this;
return InvokeAsync(VideoDecoderManagerChild::GetManagerAbstractThread(),
- __func__, [self, this]() {
- mActor->Shutdown();
+ __func__, [self]() {
+ self->mActor->Shutdown();
return ShutdownPromise::CreateAndResolve(true, __func__);
});
}
bool
RemoteVideoDecoder::IsHardwareAccelerated(nsACString& aFailureReason) const
{
aFailureReason = mHardwareAcceleratedReason;
--- a/dom/media/ipc/VideoDecoderParent.cpp
+++ b/dom/media/ipc/VideoDecoderParent.cpp
@@ -161,17 +161,17 @@ VideoDecoderParent::RecvInput(const Medi
mManagerTaskQueue, __func__,
[self, this](const MediaDataDecoder::DecodedData& aResults) {
if (mDestroyed) {
return;
}
ProcessDecodedData(aResults);
Unused << SendInputExhausted();
},
- [self, this](const MediaResult& aError) { Error(aError); });
+ [self](const MediaResult& aError) { self->Error(aError); });
return IPC_OK();
}
void
VideoDecoderParent::ProcessDecodedData(
const MediaDataDecoder::DecodedData& aData)
{
MOZ_ASSERT(OnManagerThread());
@@ -219,22 +219,22 @@ VideoDecoderParent::ProcessDecodedData(
mozilla::ipc::IPCResult
VideoDecoderParent::RecvFlush()
{
MOZ_ASSERT(!mDestroyed);
MOZ_ASSERT(OnManagerThread());
RefPtr<VideoDecoderParent> self = this;
mDecoder->Flush()->Then(
mManagerTaskQueue, __func__,
- [self, this]() {
- if (!mDestroyed) {
- Unused << SendFlushComplete();
+ [self]() {
+ if (!self->mDestroyed) {
+ Unused << self->SendFlushComplete();
}
},
- [self, this](const MediaResult& aError) { Error(aError); });
+ [self](const MediaResult& aError) { self->Error(aError); });
return IPC_OK();
}
mozilla::ipc::IPCResult
VideoDecoderParent::RecvDrain()
{
MOZ_ASSERT(!mDestroyed);
@@ -243,17 +243,17 @@ VideoDecoderParent::RecvDrain()
mDecoder->Drain()->Then(
mManagerTaskQueue, __func__,
[self, this](const MediaDataDecoder::DecodedData& aResults) {
if (!mDestroyed) {
ProcessDecodedData(aResults);
Unused << SendDrainComplete();
}
},
- [self, this](const MediaResult& aError) { Error(aError); });
+ [self](const MediaResult& aError) { self->Error(aError); });
return IPC_OK();
}
mozilla::ipc::IPCResult
VideoDecoderParent::RecvShutdown()
{
MOZ_ASSERT(!mDestroyed);
MOZ_ASSERT(OnManagerThread());
--- a/dom/media/platforms/agnostic/AOMDecoder.cpp
+++ b/dom/media/platforms/agnostic/AOMDecoder.cpp
@@ -75,18 +75,18 @@ AOMDecoder::AOMDecoder(const CreateDecod
AOMDecoder::~AOMDecoder()
{
}
RefPtr<ShutdownPromise>
AOMDecoder::Shutdown()
{
RefPtr<AOMDecoder> self = this;
- return InvokeAsync(mTaskQueue, __func__, [self, this]() {
- auto res = aom_codec_destroy(&mCodec);
+ return InvokeAsync(mTaskQueue, __func__, [self]() {
+ auto res = aom_codec_destroy(&self->mCodec);
if (res != AOM_CODEC_OK) {
LOG_RESULT(res, "aom_codec_destroy");
}
return ShutdownPromise::CreateAndResolve(true, __func__);
});
}
RefPtr<MediaDataDecoder::InitPromise>
--- a/dom/media/platforms/agnostic/VPXDecoder.cpp
+++ b/dom/media/platforms/agnostic/VPXDecoder.cpp
@@ -81,19 +81,19 @@ VPXDecoder::~VPXDecoder()
{
MOZ_COUNT_DTOR(VPXDecoder);
}
RefPtr<ShutdownPromise>
VPXDecoder::Shutdown()
{
RefPtr<VPXDecoder> self = this;
- return InvokeAsync(mTaskQueue, __func__, [self, this]() {
- vpx_codec_destroy(&mVPX);
- vpx_codec_destroy(&mVPXAlpha);
+ return InvokeAsync(mTaskQueue, __func__, [self]() {
+ vpx_codec_destroy(&self->mVPX);
+ vpx_codec_destroy(&self->mVPXAlpha);
return ShutdownPromise::CreateAndResolve(true, __func__);
});
}
RefPtr<MediaDataDecoder::InitPromise>
VPXDecoder::Init()
{
if (NS_FAILED(InitContext(&mVPX, mInfo, mCodec))) {
--- a/dom/media/platforms/agnostic/VorbisDecoder.cpp
+++ b/dom/media/platforms/agnostic/VorbisDecoder.cpp
@@ -271,22 +271,22 @@ VorbisDataDecoder::Drain()
return DecodePromise::CreateAndResolve(DecodedData(), __func__);
});
}
RefPtr<MediaDataDecoder::FlushPromise>
VorbisDataDecoder::Flush()
{
RefPtr<VorbisDataDecoder> self = this;
- return InvokeAsync(mTaskQueue, __func__, [self, this]() {
+ return InvokeAsync(mTaskQueue, __func__, [self]() {
// Ignore failed results from vorbis_synthesis_restart. They
// aren't fatal and it fails when ResetDecode is called at a
// time when no vorbis data has been read.
- vorbis_synthesis_restart(&mVorbisDsp);
- mLastFrameTime.reset();
+ vorbis_synthesis_restart(&self->mVorbisDsp);
+ self->mLastFrameTime.reset();
return FlushPromise::CreateAndResolve(true, __func__);
});
}
/* static */
bool
VorbisDataDecoder::IsVorbis(const nsACString& aMimeType)
{
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -52,39 +52,39 @@ public:
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
MOZ_RELEASE_ASSERT(mDecrypts.Count() == 0,
"Can only process one sample at a time");
RefPtr<DecodePromise> p = mDecodePromise.Ensure(__func__);
RefPtr<EMEDecryptor> self = this;
mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)
->Then(mTaskQueue, __func__,
- [self, this](RefPtr<MediaRawData> aSample) {
- mKeyRequest.Complete();
- ThrottleDecode(aSample);
+ [self](RefPtr<MediaRawData> aSample) {
+ self->mKeyRequest.Complete();
+ self->ThrottleDecode(aSample);
},
- [self, this]() {
- mKeyRequest.Complete();
+ [self]() {
+ self->mKeyRequest.Complete();
})
->Track(mKeyRequest);
return p;
}
void ThrottleDecode(MediaRawData* aSample)
{
RefPtr<EMEDecryptor> self = this;
mThroughputLimiter.Throttle(aSample)
->Then(mTaskQueue, __func__,
- [self, this] (RefPtr<MediaRawData> aSample) {
- mThrottleRequest.Complete();
- AttemptDecode(aSample);
+ [self] (RefPtr<MediaRawData> aSample) {
+ self->mThrottleRequest.Complete();
+ self->AttemptDecode(aSample);
},
- [self, this]() {
- mThrottleRequest.Complete();
+ [self]() {
+ self->mThrottleRequest.Complete();
})
->Track(mThrottleRequest);
}
void AttemptDecode(MediaRawData* aSample)
{
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
if (mIsShutdown) {
@@ -139,23 +139,23 @@ public:
} else {
MOZ_ASSERT(!mIsShutdown);
// The sample is no longer encrypted, so clear its crypto metadata.
UniquePtr<MediaRawDataWriter> writer(aDecrypted.mSample->CreateWriter());
writer->mCrypto = CryptoSample();
RefPtr<EMEDecryptor> self = this;
mDecoder->Decode(aDecrypted.mSample)
->Then(mTaskQueue, __func__,
- [self, this](const DecodedData& aResults) {
- mDecodeRequest.Complete();
- mDecodePromise.ResolveIfExists(aResults, __func__);
+ [self](const DecodedData& aResults) {
+ self->mDecodeRequest.Complete();
+ self->mDecodePromise.ResolveIfExists(aResults, __func__);
},
- [self, this](const MediaResult& aError) {
- mDecodeRequest.Complete();
- mDecodePromise.RejectIfExists(aError, __func__);
+ [self](const MediaResult& aError) {
+ self->mDecodeRequest.Complete();
+ self->mDecodePromise.RejectIfExists(aError, __func__);
})
->Track(mDecodeRequest);
}
}
RefPtr<FlushPromise> Flush() override
{
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
@@ -281,18 +281,18 @@ EMEMediaDataDecoderProxy::Decode(MediaRa
mDecodePromise.Resolve(aResults, __func__);
},
[self, this](const MediaResult& aError) {
mDecodeRequest.Complete();
mDecodePromise.Reject(aError, __func__);
})
->Track(mDecodeRequest);
},
- [self, this]() {
- mKeyRequest.Complete();
+ [self]() {
+ self->mKeyRequest.Complete();
MOZ_CRASH("Should never get here");
})
->Track(mKeyRequest);
return p;
}
RefPtr<MediaDataDecoder::FlushPromise>
--- a/dom/media/platforms/android/RemoteDataDecoder.cpp
+++ b/dom/media/platforms/android/RemoteDataDecoder.cpp
@@ -545,31 +545,31 @@ RemoteDataDecoder::ProcessShutdown()
RefPtr<MediaDataDecoder::DecodePromise>
RemoteDataDecoder::Decode(MediaRawData* aSample)
{
MOZ_ASSERT(aSample != nullptr);
RefPtr<RemoteDataDecoder> self = this;
RefPtr<MediaRawData> sample = aSample;
- return InvokeAsync(mTaskQueue, __func__, [self, sample, this]() {
+ return InvokeAsync(mTaskQueue, __func__, [self, sample]() {
jni::ByteBuffer::LocalRef bytes = jni::ByteBuffer::New(
const_cast<uint8_t*>(sample->Data()), sample->Size());
BufferInfo::LocalRef bufferInfo;
nsresult rv = BufferInfo::New(&bufferInfo);
if (NS_FAILED(rv)) {
return DecodePromise::CreateAndReject(
MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__);
}
bufferInfo->Set(0, sample->Size(), sample->mTime.ToMicroseconds(), 0);
- mDrainStatus = DrainStatus::DRAINABLE;
- return mJavaDecoder->Input(bytes, bufferInfo, GetCryptoInfoFromSample(sample))
- ? mDecodePromise.Ensure(__func__)
+ self->mDrainStatus = DrainStatus::DRAINABLE;
+ return self->mJavaDecoder->Input(bytes, bufferInfo, GetCryptoInfoFromSample(sample))
+ ? self->mDecodePromise.Ensure(__func__)
: DecodePromise::CreateAndReject(
MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__);
});
}
void
RemoteDataDecoder::UpdateInputStatus(int64_t aTimestamp, bool aProcessed)
--- a/dom/media/platforms/apple/AppleATDecoder.cpp
+++ b/dom/media/platforms/apple/AppleATDecoder.cpp
@@ -68,18 +68,18 @@ RefPtr<MediaDataDecoder::DecodePromise>
AppleATDecoder::Decode(MediaRawData* aSample)
{
LOG("mp4 input sample %p %lld us %lld pts%s %llu bytes audio", aSample,
aSample->mDuration.ToMicroseconds(), aSample->mTime.ToMicroseconds(),
aSample->mKeyframe ? " keyframe" : "",
(unsigned long long)aSample->Size());
RefPtr<AppleATDecoder> self = this;
RefPtr<MediaRawData> sample = aSample;
- return InvokeAsync(mTaskQueue, __func__, [self, this, sample] {
- return ProcessDecode(sample);
+ return InvokeAsync(mTaskQueue, __func__, [self, sample] {
+ return self->ProcessDecode(sample);
});
}
RefPtr<MediaDataDecoder::FlushPromise>
AppleATDecoder::ProcessFlush()
{
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
mQueuedSamples.Clear();
@@ -116,18 +116,18 @@ AppleATDecoder::Drain()
return DecodePromise::CreateAndResolve(DecodedData(), __func__);
});
}
RefPtr<ShutdownPromise>
AppleATDecoder::Shutdown()
{
RefPtr<AppleATDecoder> self = this;
- return InvokeAsync(mTaskQueue, __func__, [self, this]() {
- ProcessShutdown();
+ return InvokeAsync(mTaskQueue, __func__, [self]() {
+ self->ProcessShutdown();
return ShutdownPromise::CreateAndResolve(true, __func__);
});
}
void
AppleATDecoder::ProcessShutdown()
{
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
--- a/dom/media/platforms/apple/AppleVTDecoder.cpp
+++ b/dom/media/platforms/apple/AppleVTDecoder.cpp
@@ -108,18 +108,18 @@ AppleVTDecoder::Drain()
return InvokeAsync(mTaskQueue, this, __func__, &AppleVTDecoder::ProcessDrain);
}
RefPtr<ShutdownPromise>
AppleVTDecoder::Shutdown()
{
if (mTaskQueue) {
RefPtr<AppleVTDecoder> self = this;
- return InvokeAsync(mTaskQueue, __func__, [self, this]() {
- ProcessShutdown();
+ return InvokeAsync(mTaskQueue, __func__, [self]() {
+ self->ProcessShutdown();
return ShutdownPromise::CreateAndResolve(true, __func__);
});
}
ProcessShutdown();
return ShutdownPromise::CreateAndResolve(true, __func__);
}
// Helper to fill in a timestamp structure.
--- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
@@ -85,18 +85,18 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecode
return NS_OK;
}
RefPtr<ShutdownPromise>
FFmpegDataDecoder<LIBAV_VER>::Shutdown()
{
if (mTaskQueue) {
RefPtr<FFmpegDataDecoder<LIBAV_VER>> self = this;
- return InvokeAsync(mTaskQueue, __func__, [self, this]() {
- ProcessShutdown();
+ return InvokeAsync(mTaskQueue, __func__, [self]() {
+ self->ProcessShutdown();
return ShutdownPromise::CreateAndResolve(true, __func__);
});
}
ProcessShutdown();
return ShutdownPromise::CreateAndResolve(true, __func__);
}
RefPtr<MediaDataDecoder::DecodePromise>
--- a/dom/media/platforms/omx/OmxDataDecoder.cpp
+++ b/dom/media/platforms/omx/OmxDataDecoder.cpp
@@ -199,19 +199,19 @@ OmxDataDecoder::Flush()
}
RefPtr<MediaDataDecoder::DecodePromise>
OmxDataDecoder::Drain()
{
LOG("");
RefPtr<OmxDataDecoder> self = this;
- return InvokeAsync(mOmxTaskQueue, __func__, [self, this]() {
- RefPtr<DecodePromise> p = mDrainPromise.Ensure(__func__);
- SendEosBuffer();
+ return InvokeAsync(mOmxTaskQueue, __func__, [self]() {
+ RefPtr<DecodePromise> p = self->mDrainPromise.Ensure(__func__);
+ self->SendEosBuffer();
return p;
});
}
RefPtr<ShutdownPromise>
OmxDataDecoder::Shutdown()
{
LOG("");
--- a/dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp
+++ b/dom/media/platforms/wrappers/MediaDataDecoderProxy.cpp
@@ -13,75 +13,75 @@ MediaDataDecoderProxy::Init()
{
MOZ_ASSERT(!mIsShutdown);
if (!mProxyThread) {
return mProxyDecoder->Init();
}
RefPtr<MediaDataDecoderProxy> self = this;
return InvokeAsync(mProxyThread, __func__,
- [self, this]() { return mProxyDecoder->Init(); });
+ [self]() { return self->mProxyDecoder->Init(); });
}
RefPtr<MediaDataDecoder::DecodePromise>
MediaDataDecoderProxy::Decode(MediaRawData* aSample)
{
MOZ_ASSERT(!mIsShutdown);
if (!mProxyThread) {
return mProxyDecoder->Decode(aSample);
}
RefPtr<MediaDataDecoderProxy> self = this;
RefPtr<MediaRawData> sample = aSample;
- return InvokeAsync(mProxyThread, __func__, [self, this, sample]() {
- return mProxyDecoder->Decode(sample);
+ return InvokeAsync(mProxyThread, __func__, [self, sample]() {
+ return self->mProxyDecoder->Decode(sample);
});
}
RefPtr<MediaDataDecoder::FlushPromise>
MediaDataDecoderProxy::Flush()
{
MOZ_ASSERT(!mIsShutdown);
if (!mProxyThread) {
return mProxyDecoder->Flush();
}
RefPtr<MediaDataDecoderProxy> self = this;
return InvokeAsync(mProxyThread, __func__,
- [self, this]() { return mProxyDecoder->Flush(); });
+ [self]() { return self->mProxyDecoder->Flush(); });
}
RefPtr<MediaDataDecoder::DecodePromise>
MediaDataDecoderProxy::Drain()
{
MOZ_ASSERT(!mIsShutdown);
if (!mProxyThread) {
return mProxyDecoder->Drain();
}
RefPtr<MediaDataDecoderProxy> self = this;
return InvokeAsync(mProxyThread, __func__,
- [self, this]() { return mProxyDecoder->Drain(); });
+ [self]() { return self->mProxyDecoder->Drain(); });
}
RefPtr<ShutdownPromise>
MediaDataDecoderProxy::Shutdown()
{
MOZ_ASSERT(!mIsShutdown);
#if defined(DEBUG)
mIsShutdown = true;
#endif
if (!mProxyThread) {
return mProxyDecoder->Shutdown();
}
RefPtr<MediaDataDecoderProxy> self = this;
return InvokeAsync(mProxyThread, __func__,
- [self, this]() { return mProxyDecoder->Shutdown(); });
+ [self]() { return self->mProxyDecoder->Shutdown(); });
}
nsCString
MediaDataDecoderProxy::GetDescriptionName() const
{
MOZ_ASSERT(!mIsShutdown);
return mProxyDecoder->GetDescriptionName();