本文整理汇总了C++中IsOnGMPThread函数的典型用法代码示例。如果您正苦于以下问题:C++ IsOnGMPThread函数的具体用法?C++ IsOnGMPThread怎么用?C++ IsOnGMPThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsOnGMPThread函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MOZ_ASSERT
void
GMPVideoDecoder::DrainComplete()
{
MOZ_ASSERT(IsOnGMPThread());
mDrainPromise.ResolveIfExists(mDecodedData, __func__);
mDecodedData.Clear();
}
示例2: MOZ_ASSERT
void
GMPAudioDecoder::GMPInitDone(GMPAudioDecoderProxy* aGMP)
{
MOZ_ASSERT(IsOnGMPThread());
if (!aGMP) {
mInitPromise.RejectIfExists(MediaDataDecoder::DecoderFailureReason::INIT_ERROR, __func__);
return;
}
if (mInitPromise.IsEmpty()) {
// GMP must have been shutdown while we were waiting for Init operation
// to complete.
aGMP->Close();
return;
}
nsTArray<uint8_t> codecSpecific;
codecSpecific.AppendElements(mConfig.mCodecSpecificConfig->Elements(),
mConfig.mCodecSpecificConfig->Length());
nsresult rv = aGMP->InitDecode(kGMPAudioCodecAAC,
mConfig.mChannels,
mConfig.mBitDepth,
mConfig.mRate,
codecSpecific,
mAdapter);
if (NS_FAILED(rv)) {
aGMP->Close();
mInitPromise.Reject(MediaDataDecoder::DecoderFailureReason::INIT_ERROR, __func__);
return;
}
mGMP = aGMP;
mInitPromise.Resolve(TrackInfo::kAudioTrack, __func__);
}
示例3: MOZ_ASSERT
void
AudioCallbackAdapter::ResetComplete()
{
MOZ_ASSERT(IsOnGMPThread());
mMustRecaptureAudioPosition = true;
mCallback->FlushComplete();
}
示例4: MOZ_ASSERT
void
CDMProxy::gmp_Init(nsAutoPtr<InitData>&& aData)
{
MOZ_ASSERT(IsOnGMPThread());
nsCOMPtr<mozIGeckoMediaPluginService> mps =
do_GetService("@mozilla.org/gecko-media-plugin-service;1");
if (!mps) {
RejectPromise(aData->mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
NS_LITERAL_CSTRING("Couldn't get MediaPluginService in CDMProxy::gmp_Init"));
return;
}
// Make a copy before we transfer ownership of aData to the
// gmp_InitGetGMPDecryptorCallback.
InitData data(*aData);
UniquePtr<GetNodeIdCallback> callback(
new gmp_InitGetGMPDecryptorCallback(this, Move(aData)));
nsresult rv = mps->GetNodeId(data.mOrigin,
data.mTopLevelOrigin,
data.mGMPName,
data.mInPrivateBrowsing,
Move(callback));
if (NS_FAILED(rv)) {
RejectPromise(data.mPromiseId, NS_ERROR_DOM_INVALID_STATE_ERR,
NS_LITERAL_CSTRING("Call to GetNodeId() failed early"));
}
}
示例5: MOZ_ASSERT
nsresult
EMEAudioDecoder::GmpInit()
{
MOZ_ASSERT(IsOnGMPThread());
nsTArray<nsCString> tags;
tags.AppendElement(NS_LITERAL_CSTRING("aac"));
tags.AppendElement(NS_ConvertUTF16toUTF8(mProxy->KeySystem()));
nsresult rv = mMPS->GetGMPAudioDecoder(&tags,
mProxy->GetNodeId(),
&mGMP);
NS_ENSURE_SUCCESS(rv, rv);
MOZ_ASSERT(mGMP);
mAudioRate = mConfig.samples_per_second;
mAudioBytesPerSample = mConfig.bits_per_sample / 8;
mAudioChannels = mConfig.channel_count;
nsTArray<uint8_t> extraData;
extraData.AppendElements(&mConfig.audio_specific_config[0],
mConfig.audio_specific_config.length());
mGMP->InitDecode(kGMPAudioCodecAAC,
mAudioChannels,
mConfig.bits_per_sample,
mAudioRate,
extraData,
this);
return NS_OK;
}
示例6: MOZ_ASSERT
void
GMPVideoDecoder::Input(MediaRawData* aSample)
{
MOZ_ASSERT(IsOnGMPThread());
RefPtr<MediaRawData> sample(aSample);
if (!mGMP) {
mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
RESULT_DETAIL("mGMP not initialized")));
return;
}
mAdapter->SetLastStreamOffset(sample->mOffset);
GMPUniquePtr<GMPVideoEncodedFrame> frame = CreateFrame(sample);
if (!frame) {
mCallback->Error(MediaResult(NS_ERROR_OUT_OF_MEMORY,
RESULT_DETAIL("CreateFrame returned null")));
return;
}
nsTArray<uint8_t> info; // No codec specific per-frame info to pass.
nsresult rv = mGMP->Decode(Move(frame), false, info, 0);
if (NS_FAILED(rv)) {
mCallback->Error(MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
RESULT_DETAIL("mGMP->Decode:%x", rv)));
}
}
示例7: MOZ_ASSERT
nsresult
GMPAudioDecoder::Init()
{
MOZ_ASSERT(IsOnGMPThread());
mMPS = do_GetService("@mozilla.org/goanna-media-plugin-service;1");
MOZ_ASSERT(mMPS);
nsTArray<nsCString> tags;
InitTags(tags);
nsresult rv = mMPS->GetGMPAudioDecoder(&tags, GetNodeId(), &mGMP);
NS_ENSURE_SUCCESS(rv, rv);
MOZ_ASSERT(mGMP);
nsTArray<uint8_t> codecSpecific;
codecSpecific.AppendElements(mConfig.audio_specific_config->Elements(),
mConfig.audio_specific_config->Length());
rv = mGMP->InitDecode(kGMPAudioCodecAAC,
mConfig.channel_count,
mConfig.bits_per_sample,
mConfig.samples_per_second,
codecSpecific,
mAdapter);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
示例8: MOZ_ASSERT
nsresult
EMEH264Decoder::Flush()
{
MOZ_ASSERT(!IsOnGMPThread()); // Runs on the decode task queue.
MOZ_ASSERT(!mIsShutdown);
{
MonitorAutoLock mon(mMonitor);
mFlushComplete = false;
}
nsRefPtr<nsIRunnable> task;
task = NS_NewRunnableMethod(this, &EMEH264Decoder::GmpFlush);
nsresult rv = mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
NS_ENSURE_SUCCESS(rv, rv);
{
MonitorAutoLock mon(mMonitor);
while (!mFlushComplete) {
mon.Wait();
}
}
return NS_OK;
}
示例9: MOZ_ASSERT
void
CDMProxy::gmp_Decrypted(uint32_t aId,
GMPErr aResult,
const nsTArray<uint8_t>& aDecryptedData)
{
MOZ_ASSERT(IsOnGMPThread());
for (size_t i = 0; i < mDecryptionJobs.Length(); i++) {
DecryptJob* job = mDecryptionJobs[i];
if (job->mId == aId) {
if (aDecryptedData.Length() != job->mSample->size) {
NS_WARNING("CDM returned incorrect number of decrypted bytes");
}
if (GMP_SUCCEEDED(aResult)) {
PodCopy(job->mSample->data,
aDecryptedData.Elements(),
std::min<size_t>(aDecryptedData.Length(), job->mSample->size));
job->mClient->Decrypted(GMPNoErr, job->mSample.forget());
} else if (aResult == GMPNoKeyErr) {
NS_WARNING("CDM returned GMPNoKeyErr");
// We still have the encrypted sample, so we can re-enqueue it to be
// decrypted again once the key is usable again.
job->mClient->Decrypted(GMPNoKeyErr, job->mSample.forget());
} else {
nsAutoCString str("CDM returned decode failure GMPErr=");
str.AppendInt(aResult);
NS_WARNING(str.get());
job->mClient->Decrypted(aResult, nullptr);
}
mDecryptionJobs.RemoveElementAt(i);
return;
}
}
NS_WARNING("GMPDecryptorChild returned incorrect job ID");
}
示例10: MOZ_ASSERT
void
EMEH264Decoder::Terminated()
{
MOZ_ASSERT(IsOnGMPThread());
NS_WARNING("H.264 GMP decoder terminated.");
GmpShutdown();
}
示例11: MOZ_ASSERT
void
CDMProxy::gmp_Terminated()
{
MOZ_ASSERT(IsOnGMPThread());
EME_LOG("CDM terminated");
if (mCDM) {
mCDM->Close();
mCDM = nullptr;
}
}